如何识别【market close】,或者跳过去

 

我做H4的EA,就是每到4小时(例如0点,4点,8点等)就会Ontick()开始检测下单或修改订单止损,但是经常在0点出现问题,

2024.03.01 14:11:27.787    2021.04.22 00:00:00   failed modify #3 buy 0.23 GBPJPY sl: 149.835, tp: 0.000 -> sl: 149.891, tp: 0.000 [Market closed]


如何处理 ,识别这种情况,有没有识别的函数?或者跳过去, 谢谢

 

SymbolInfoSessionTrade

參考一下這個指令 編輯一個自訂義用來識別是否為交易時間

 
那你直接限定某个时间段return回开始不就好了
 
这种情况大概率是服务器的报价与交易的问题。那个时间,只能报价,不能交易。而你的EA在那时要修改交易指令,所以报错。可参考

SymbolInfoSessionQuote(

)和

SymbolInfoSessionTrade


 
谢谢,以上提供帮助的各位!
 
这个帖子https://www.mql5.com/en/forum/373227 有完整的描述
How to check 'Market is closed' befor opening a position? - My expert advisor is trying to open a position immediately at time 00.00, because the market is closed during Friday night and
How to check 'Market is closed' befor opening a position? - My expert advisor is trying to open a position immediately at time 00.00, because the market is closed during Friday night and
  • 2021.07.13
  • Zsolt Haromszeki
  • www.mql5.com
My expert advisor is trying to open a position immediately at time 00:00. I get 'market is closed' ( trade_retcode_market_closed , error code: 10018) message, because the trading is start only at time 00:01: how can i check in advance if it is possible to open a position
原因: