Enter on Open Bar

 有两种办法实现根据tick数据触发信号。第二种值得推荐,代码简洁。

  1. 时间邮戳


    extern bool EnterOpenBar = true; 
    int CurrentTime;
    int init(){
    CurrentTime= Time[0];
    return(0);
    }
    int start(){
    if (EnterOpenBar) = true)
    {
    if(CurrentTime != Time[0]){
    // first tick of new bar found
    // buy and sell conditions here
    CurrentTime= Time[0];
    return(0);
    }
    }


  2. 成交量检查


    extern bool EnterOpenBar = true; 
    int start ()
    bool OpenBar=true;
    if(EnterOpenBar) if(iVolume(NULL,0,0)>1) OpenBar=false;
    if (OpenBar) {
    // first tick of new bar found
    // buy and sell conditions here
    return (0);
本博客所有文章如无特别注明均为原创。作者:天泓评测
分享到:更多

相关推荐

发表评论

路人甲 表情
Ctrl+Enter快速提交

网友评论(0)