SIMPLE CROSS CONDITION NOT EXECUTED
-
Hi folks,
during my testing I've seen that sometimes an ea with a cross condition does not enter.
Imagine a simple ea on M1 like:no trade->
condition block (ask price crosses above sma 20)->
once per bar->
buy now.99% the Ea sees the tick where price crosses the ma but in 1% of case, if there is a peak in volatility, even if the price crosses the moving average the trade is not executed. Maybe because the Ea does not see the cross (maybe because there is not the singular tick where the condition is valid).
Have you ever faced and solved that situation? And how?
Thanks in advance! -
Ticks are price change, so if a candle moves it is because of a tick or a few. I can't say I have noticed this, maybe broker not updating the chart quickly enough, so the price move is more of a jump.
-
@jstap Yeah, exactly like that, "a jump". It was a luck I was on demo because not seeing a simple cross condition could be a huge problem. I was wondering if I can "solve" it in some way maybe creating a zone of 5 points like:
condition (ask >= price x) and after condition (ask <= price x+5)
but if the onceparbar block does not work properly it will probably open 2 positions...
Also using "condition ask[1] crosses above ma [1]" is viable but it will make the ea twice his weight and of course if it closed a position just the candle before probably the setup Is already done and so opening another one could not be the case. -
Once per bar works only once per, but there are reasons why it would work more than once (although not on backtest), you could save the candle time to a global variable, and check this before acting on a setup
-
@jstap mmmh... thanks! I'll give it a try. You are talking about something like this: https://fxdreema.com/shared/fBccUkcA
I assumed that onceparbar with "Max time to pass" set to 1 meant that all blocks below could pass only once but I saw that in some instances it passes two times. Do you think this is because of milliseconds and so it's solved filtering the time in a variable?
-
In that modify should only work once per bar, but the buy tree will work as many times as needed