Help Bulding MA crossover EA
-
Hi there,
I am trying to build an EA that opens a trade when a bar opens above or below an MA & only once. On the first bar only and not on every bar that opens after it. So basically one trade after every cross of the MA.
I created one but seem to open on every bar after a trade is closed. How do I stop it from doing that. I also need allot of work on the trailing stop side.
Thanks for any help. -
You are working with >. Try with x>.
But I don't like the way your blocks are connected. Please, take a look at these:
https://fxdreema.com/demo/mt4-wrong-closing-rule
https://fxdreema.com/demo/mt4-once-per-bar -
Thank you for your response.
just to clarify, you are saying if I add (X>) that will not allow another trade because as long as price stays over EMA there is no cross over and no new trade will initiate.I need help with the next strep.
For example, when price crosses over the EMA, I want it to look at the Custom indicator I have added before openning a buy. In the indicator there is a trade line and an RSI line. The RSI line should cross above the trade line as the price crosses over the EMA or no trade. I have loaded the indicator into FxDreema, but need to know what to use and how to set it up? Do I use it in condition box & how?
I also have the same indicator that issues an alert signal. Which would be better to use?
Thanks. -
When you have x>, this means that the Condition block does 2 checks - one > for the current candle and another < for the previous candle. More info here: https://fxdreema.com/demo/mt4-crossover-indicators This means that the x> state... I mean the time period where both checks are true... can be up to 1 candle long. When that candle is closed, this x> is no more true. While if you use >, this remains true for all candles where one of the lines is above the other, until they cross.
But because x> remains true for multiple ticks (while the current exists), "Once per bar" is used to catch only the first one.
If you have 2 blocks with different indicators connected one after another and if x> (or x<) is used, then better don't expect both crossovers to happen at the same candle. Instead, leave x> (or x<) only in one Condition and in the other use > or <. You know, if now MAx is > than MAy, this means that MAx crossed MAy some time ago.
There is another kind of crossover as well - https://fxdreema.com/demo/mt4-price-vs-indicator