There is no "second 0" of a candle.
So if there's no new tick, even when the new candle has startet
If there is no new tick, there is no new candle, it's how MT4 (and MT5) are working. To be clear, an example : timeframe H1, we have a candle with time 09:00, the candle with time 10:00 will only be created on the first tick after 10:00. It could be 10:00:00 or 10:00:10 or 10:01 or whatever.
From there it depends of your need how you will deal with that.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
How to check for second 0 of a candle in different currencys / and check a condition on the previous candle / to start an order
Background
I work on an EA to place an orders at second 0, when a condition is true.
This EA is running in one Chart – one Currency – but it checks conditions for different currencys.
TimeCurrent() Issue
Condition – check the previous candle
The condition will check the last candle (index 1) , when the current candle (index 0) has opened and it's second 0.
In other words, when we are in second 0 of a new candle, the condition will check the previous candle and if the condition is true, an order will be generated.
iTime() Issue
Lets stay in one timeframe, and just look at different currencys, that are analysed by the EA, thats running in only one chart:
On my way getting these two things (second-0 and condition) together, i found out, that on some currencys the iTime() call sometimes returns the new-candle-time, or sometimes the time of the previous candle. How can that, be? The new candle has startet but, at some currencys iTime() returns the time of the old, previous candle.
My explaination is, that the metatrader 4 gets a timestamp with every tick of a certain currenys. And thats the time especially for that one tick in that one currency. So if there's no new tick, even when the new candle has startet, for that one curreny, you will get the last known candle time where the last tick was in, if you call iTime(). Is that right?
My Conclusion
So, we need the condition that checks the previous candle to start a trade.
I thought, we might do it in two cases than:
Questions