I have a doubt with the logic of the conditions.
-
I have a doubt with the logic of the conditions. I'm going to give an example with crossings of emas, but only so they can help me, and that logic applies to any project.
Imagine that my strategy is based on entering a pullback after crossing of emas, how can I put it so that first it is the crossing then the condition that a candle closes below the ema and then another that closes above that would be the operation trigger.
As I make the EA understand that one goes after the other and that to meet the last condition the first still remains.
I suffer from always giving the IDs the number 1 to be able to optimize by open bar, so I don't know how to do it.
-
great question . i would like to know too. you mean trade condition met after recent ema cross. thats when all the good trades happen. you could write like ema was in the opposite direction 10& 15& 20 candles ago so you know theres a trend change.
-
@mcarl42 I want to create an EA that has many conditions, but doing it without variables is giving me a lot of problems in order in logic.
How can I do to save the cross of a 5 x ema> ema 21 (it is an example) save a variable with that cross and only if I pass that cross (but still remains) I mean that the ema 5 is still above the 21, then move on to the next condition and thus not create conflicts in the code that all conditions pass in the candle ID 0 or ID 1.
The point is that there are conduits that must pass after other conditions and not in the same candle
-
yer i know what you mean. im only new here to coding but have lots of experience with charts. i would still write in the code that the ema has only been above ( say its a long trade) for x amount of candles and before that its was opposite , which means writing every ID no#. say ID 1 - 7 ema > ema 7 and before that was <. thats how id do it anyway. i have been thinking about the same thing how to get a signal just after ema cross or within certain bars. hope this helps but people here ( coders) will know better.
-
@MIRO1360 please help bro
-
You need to create a variable to store that value there by using a 'Modify variable' block. Then you can use that same variable as a condition to me met later in the EA.
-
the inspiration which recently celebrated its third birthday

https://fxdreema.com/forum/topic/4222/example-price-pullback-ea -
@l-andorrà can you help me with an example please?
-
Miro's answer is the solution to what you are looking for.