有两种办法实现根据tick数据触发信号。第二种值得推荐,代码简洁。
时间邮戳
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); } }
成交量检查
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);
发表评论