double crosses condition
-
Hello friends,
I have a small bump that i can't get over and i need some help please.
I am trying to create a simple EA (an example from babypips) when the 10EMA crosses 20EMA and MACD signal line crosses the main line.
The crosses can happen within a span of 3 or 4 bars and any of the two conditions can come first.
Here is an example (green area is a valid signal, red areas are not valid signals since both conditions are not met):

The only logical thing i could come up with is in this example where it checks if the 10EMA and MACD are in buy or sell positions and if the signals were in opposite position 4 bars behind. it seems logical to me (as a new user) but it does not generate any signal. Maybe i am arranging the them wrong, maybe it can be done in a different way.
https://fxdreema.com/shared/ZXJbCFndc
Please help, thank you,
A -
@akulus For the crosses you can take x> or X< condition. Specify the witdt to 3 and I guess that that's what you need. Do this for both, EMA crosss and MACD zero line cross.
The width days the cross must have happened within the number of specified candles and the condition stays valid (for 0 line cross down, the rest of the candles after x<0 happened, it stayed below 0).
Does that make sense?
-
thank you for answering me trader.philipps
i am not sure i understand. you mean to use the width to 3 for both and use both conditions with 'and'?
something like this? https://fxdreema.com/shared/ncNBdXCyd
if yes, it does not work.
-
I recommend you to substitute both 'AND' blocks and put instead blocks 74 and 76 in their place. The effect is the same at all effects. Their current position means they are executed AFTER block 72, so weird things can happen.
-
@l-andorrà and @trader-philipps thank you both very much.
i have reached to this version which shows some results and even some profit https://fxdreema.com/shared/HB8LdSnce (there is also a trailing section that is not included here).
however, looking at the backtest there are some missed signals and all the entries are after quiet periods.
i think i am using macd wrong. should it check for signal line crossing main line or main line crossing 0 value?
-
@akulus Okay, let's get through it one by one ..

Use another path with if trade for instance.
For your conditions block use both with width 5 and use just 1 path per sells and 1 per buys.
You have no trade block in the begining so first macht in conditions will open trade in either case.Change that and show maybe in screenshot where something was missed.
Like this it works at least so much as you described.

Entire project: 0_1581457083201_exp.mq4

-
@trader-philipps you are right and it works as i described.
thank you very much for your time and patience to explain to me. as you, for sure, can tell i am just starting with fxdreema and i am not that very technical person. i greatly appreciate your help.