bruno_shady: I need to know the current time from the candle and know if it's in it's midle life.
- You know when the candle begins. Time[0] or the MT5 equivalent.
- You know when the candle ends. begins + PeriodSeconds(_Period)
- You know the middle. (Begin+End)/2
William Roeder #:
You know the middle. (Begin+End)/2
You know the middle. (Begin+End)/2
You made a typo, it doesn't look like the middle of a candle.
bool permission = TimeCurrent() > Time[0] + PeriodSeconds(_Period) / 2; //... if(permission) makeDecisions();
This is for MQL4. For MQL5, replace Time[0] with the current candle open time.
(I haven't tested it)
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
Hello everybody,
I need a little help and I don't know where to start.
I need to know the current time from the candle and know if it's in it's midle life.
For example, a timeframe of 5 minutes, I wanna know when this candle passes it's 2:30 minutes. Same as 10 timeframe, where I wan't to do something when it passes 5 minutes.
I wan't to try to make decisions, on the OnTick function, only when the candle passes 50% of it's life..
I don't know if it's clear what I'm trying to achieve here.
I'm sorry about my english and if did something wrong.
Thanks in advance.