Every "N" Bars
-
I am creating a 15 Bar Trade Setup. Is This Correct... No Trade Running> Indicator Appears > Every "N" Bars > MA X> MA > etc....
If This Is Correct, I'm actually looking for the cross-over to occur within the 15 bars after the indicator appears. Does it matter what candle I set the cross-over condition to occur?
REFERENCE: FILE: AUTONOMY PROGRAM (Block 51 Down)

-
If you use "Condition" block for crossover, then this block works in the whole candle. Check this to see how it works: https://fxdreema.com/documentation/proj ... er%20works
There are two different crossover blocks in "Indicators" category, they are a little bit different - they produce 1-time signals.
Every N bars passes ONCE on every N bars, so it probably matters where it is placed.
Get some "Draw arrow" and connect it below some condition that is used. Then one step below... one step below... and if some block does not produce the signals you need, you will see it immediately.
-
I see your concept. Thank you. I will be entering the trade at the bar immediately after crossover. The crossover must occur within 15 bars from the first indicator condition trigger. Wouldn't it work if I eliminate "N" Bars completely and set the Crossover width to 15? It would start the count of bars from the first condition trigger correct?
No Trade Is Running > Condition "Indicator Arrow Appears"> MA>XMA (Width 15) > Enter Buy?
-
This "cross width" parameter is something that I added without many thinking, I don't think it's appropriate for your case. You can see what this parameter means here: https://fxdreema.com/documentation/proj ... er%20works
In any case, it does not mean that the crossover is detected on every X bars. It will probably cause the Condition to pass even more often. -
I have studied the Cross Over structure as you suggested. I am testing many options with no success. Here is what I need if you could help?
Indicator appears > Within the next 15 bars a cross over occurs with two moving averages. The problem is not the cross over, it is the condition that requires the cross over to occur within a number of candles or the trade is disqualified.
I tried "Every "N" Bars" in different places with no success. I must be missing something because Other users Must have had a trade setup with the conditions occurring within a given number of bars?

-
Now study this: https://fxdreema.com/demo/mt4-wrong-closing-rule
many people think that some block should wait for some time and then it will pass and go to the next block. Not true, this does not happen at all. What really happens is that blocks under "on Tick" become active on every tick, again and again, and again, and again - the very same blocks. Well, those on top level at least.
There is no block that will wait 15 candles for something. Blocks work NOW, at the moment. If it's some condition - it works now. If you want to check the current indicator values, fine. If you want to check past indicator values - also fine. Checking future indicator values... no way.
And because so many people think the wrong way, which is in fact the most intuitive way, I thought that I can make it that way... but then I realized that this is not a good idea for some reasons.
So again, you can check anything using the "Condition" block NOW, but the "Condition" block will not wait for the comparison inside to happen. The only block that can wait for some time (but not waiting for something to happen) is called "Delay".
What you can do is to check for crossover NOW and also check for the other indicator 15 candles in the past. Just thing in the opposite way.
Why is that better? Because MetaTrader already have history data that can be accessed. Also because saying that you want to check something in the future requires the use of some variables - the problem here is that if you restart the EA those variables will be gone, they are not persistent. But if you check the past data, in case you restart the EA, that data will still be there and the same, so the EA will continue working as before.