卤煮2001 发表于 2015-10-2 18:48:33

疑难杂症,为什么Sleep函数在历史回测中,不起作用呢?

编写一段代码,要求满足某个条件后,或者开机运行EA后,先暂停几十秒钟,再运行。。。



比如这个例子,开机运行ea,暂停10000毫秒,如果当前单子数为0,再开多单,止损止盈都为10个点。
Sleep(10000);
if(OrdersTotal()==0)
{
    OrderSend(Symbol(),OP_BUY,0.1,Ask,3,Ask-10*Point,Ask+10*Point,"M",1,0,Green);
}

但是问题来了,疑难杂症,实际真实行情运行的时候,可以运行,但是历史回测的时候,Sleep却不起作用,这是问什么呢?

试了好多次,实在搞不定了。。。

tempasdf 发表于 2015-10-3 06:40:23

本帖最后由 tempasdf 于 2015-10-3 06:42 编辑

The Sleep() function can't be called for custom indicators, because indicators are executed in the interface thread and must not slow down it. The function has the built-in check of EA halt flag every 0.1 seconds.

Sleep() function does not suspend execution of the Expert Advisor in the Strategy Tester.
杂什么症呀读过说明没有
最后一句意思就是不支持在EA测试中使用

其实想想也是 一年的时间让你一天中完了 sleep什么呀??总的时间让你压缩了 sleep还有什么用呀

hljlyf 发表于 2016-9-16 23:51:30

回复有真情,积分算目标,学习需努力,赚钱是唯一

EUR168 发表于 2016-10-11 00:31:09

这个真心能够盈利的。

sunsky 发表于 2017-2-26 08:48:40

tempasdf 发表于 2015-10-3 06:40
The Sleep() function can't be called for custom indicators, because indicators are executed in the i ...

现在终于明白英语的重要性了‘
页: [1]
查看完整版本: 疑难杂症,为什么Sleep函数在历史回测中,不起作用呢?