creativesraka.blogg.se

Ivolume mql one trade per bar
Ivolume mql one trade per bar




ivolume mql one trade per bar

LOL) NOT to trade on the same Bar when MegaTrader4 or EA restarts.

#IVOLUME MQL ONE TRADE PER BAR HOW TO#

Now, to clearify this - TradeOncePerBar is NOT the problem, problem is how to tell the EA (I tried yelling, whispering and singing with guitar, but it didn't work. Maybe can using new bar function for more easy. Please somebody point me to the Path of the Correct Code. Print ("BUY order opened " + Symbol() + " because GV TradedThisBar = 0!") Įither EA will not trade at all or it trades on same Bar at MT4 restart. if (GlobalVariableGet ("TradedThisBar_" + Symbol()) = 0)īuy (Lots, BuySL, 0, magic, " 7Chi BUY " + Symbol()) Print ("GV TradedThisBar BUY -> FALSE (0), iTime = " + TimeToStr GlobalVariableSet ("TradedThisBar_" + Symbol(), TradedThisBar) (iTime (NULL, OncePerBarTF, 0)) + " at " + TimeToStr (TimeCurrent(),Įlse TradedThisBar = iTime (NULL, OncePerBarTF, 0) Print ("GV TradedThisBar BUY -> TRUE (1), iTime = " + TimeToStr GlobalVariableSet ("TradedThisBar_" + Symbol(), 1) If (GlobalVariableGet ("TradedThisBar_" + Symbol()) = iTime (NULL, OncePerBarTF, 0)) // GlobalVariableGet is Double, it should match with iTime which is Integer If (!GlobalVariableCheck ("TradedThisBar_" + Symbol())) GlobalVariableSet ("TradedThisBar_" + Symbol(), TradedThisBar) EUR USD it opened 2 trades at once !!! when MT4 restarted If (TradedThisBar = iTime (NULL, OncePerBarTF, 0)) return(0) ĭatetime CheckAlertTime, TradedThisBar // this variation makes no tradesĭatetime TradedThisBar = 0 // this works irratic - it works,īut for ex. If (CheckAlertTime = iTime (NULL, 5, 0)) return(0) Įlse CheckAlertTime = iTime (NULL, 5, 0) Original function for TradeOncePerBar is:

ivolume mql one trade per bar

I want to store the value in GlobalVariableSet to prevent EA trading in same Bar when MT4 or EA restarts. I have EA (Yeaaa!) which uses selectable Time Frame TradeOncePerBar function.






Ivolume mql one trade per bar