Exit after n bars
-
Is it possible to add a block, or include in the buy and sell blocks, the option to exit after n bars? At the moment, all you can do is specify a time to expire, or a number of days, hours, minutes etc to expire. This makes it really difficult to move between timeframes. It would be much simpler if you could just specify that you want to exit the trade at the end of the current bar, or in 5 bars time.
Thanks
JRod
-
First of all, better forget about the "end of the bar" idea - https://fxdreema.com/help/working-with/on-candle-close
There is no such expiration. I added these expiration settings when I was making EAs capable of working for Binary Options brokers, so expiration settings are just a bonus for Forex

But you can try something like Once per bar -> For each Trade -> check age -> close
-
The check age block still requires us to input how many minutes, hours or days. The problem is that this will be different depending on whether I am running the system on a M5, H1 or D1 timeframe. Is there a way to close a trade on the open of a new bar (without preventing you from potentially opening another trade at the same time).
-
There is a way for everything... but the way is sometimes longer

I don't understand the question very much. Block "Buy now" makes a new trade every time it runs. It doesn't care of which candle it is, what time it is... only cares about how much money there are

Block like "Close trades" (if you use it) also does its job. So be careful when you use such blocks. Many people are asking me why they see multiple trades opening and closing again and again. Do not allow blocks like "Close trades" to run at the same time as "Buy now".
No, there is no expiration mode that will wait for certain candle to be opened. My idea was that you can set some time. And this time can also be calculated according to the current timeframe. There is a function that returns the current period - Period(). And if the period is M15, it will return 15 (which is the value of PERIOD_M15)
-
take inspiration from this:
https://fxdreema.com/shared/cSODkTjB -
Thats very useful, thanks Miro.
On using ths Period() function, could I then use this to specify the number of minutes to close. So if I'm on a daily timeframe and want to close after one bar, I would have expire in 1440 minutes (i.e. Period())?
-
in block Modify variables this Timeframe parameter can be changed to fixed Timeframe,
if you will have opened chart H4 and trade closed on H1, you need fixed this TF in block to H1
when is parameter Timeframe = Current, it means currently opened chart is active and is waiting for closed candle on active chart TF