Here I want to provide an answer for a common question on Fxdreema:
How to open a trade at Candle Open ...and close it at candle close time.
I suggest to do it like this (example for 5MIN chart ONLY) : shared example
But if somebody knows better ...
Open Trade at candle open and close the trade at candle close
-
Here I want to provide an answer for a common question on Fxdreema:
How to open a trade at Candle Open ...and close it at candle close time.
I suggest to do it like this (example for 5MIN chart ONLY) : shared example
But if somebody knows better ... -
"Once per tick" is not needed.
Ok, but still, the EA will receive ticks and only do something because of that. If there are no ticks, nothing will happen. The problem is that ticks does not come in regular periods of time, there could be period of let's say few seconds without ticks, and why not more than a minute? So you can easily miss those "Time == 10:25" moments.
We can detect the closing of a candle accurately if we use that "Timer" event. But again, we will have the same problems with the ticks in the backtester, because the Timer event doesn't work like in the real life when backtesing. So I think it's much simple to just do everything in the beginning of new candles.
- 2 years later
-
Hi There,
I have tried to put a timer to get candle close but on back test this does not trigger. is there a way around this?
What I am trying to do. I want to open a trade at the start of the 1 min candle and then close (59 seconds) and then open a trade on the next candle. can this be done?
many thanks
-
Time is not working on bakctesting. That means all blocks on the 'On timer tab' will never be executed when backtesting. Why do you exactly need to close it after 59 s and not simply doing it on the next open price?
- 2 months later
-
I have similar issue @l-andorrà , and I think your answer can also be a solution for me: if I cannot close a position (MT5) after 5 minutes, then I can close my position when candle 6 is open, or better when candle 4 is closed (timeframe is M1, 1 position is open 5 minutes).
How should I imposed such type of condition (doesn't matter win/lost position)?
I waiting with higher interest feedback. -
I'm not sure I fully understand you. What do you exactly need?
-
@l-andorrà , what I want to do is to close my position without take into account win or loss position, but is a must for me after a specific time (or imposed time), in my case 5M. But I can change to 10M, 15M, ...
I see that exist some possibility to close my position using candles, but I don't know how.
I can close trade when 4M candle is close (4,59 min), or to close trade when 6M candle is open.
Please let me know if you need other information.
Thank you for support. -
I see you opened another thread for this same issue. Solution will be there.
- 2 years later
-
You can do than by set the close trade for example
15M Bar open trade at open candle and set close trade block but by time after 15M
But my question that how could you detect the candle if it Bulls or Bears candle? -
@mohammedaldahas time now==candle time is candle open, if you are talking about candle 1 then the bull/bear signal block, as for current candle at open it is neither, can be either during the formation, the same block can be used to detect this.