Questions from Beginners MQL5 MT5 MetaTrader 5 - page 375
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
1. Determine the opening time of the daily candle;
Determine the number of bars num on the TF you want (if you want to check the extremum of the day every 15 minutes - M15 bars);
3. Receive the data high for num bars;
3. In the loop, compare all the values of high bars with the variable dayHigh for the desired day candle (initially dayHigh = 0);
4. If high > dayHigh, you store the new value in the dayHigh variable;
This is understandable, thanks. But so far it is complicated for me... or rather point 2, it should be calculated for each TF and put in ranges to find the number of candlesticks?
Can't we just find out the date of the current timeframe and look through all values for the date, without counting the number of candles that have passed?
That's understandable, thank you. But so far it's complicated for me... or more precisely point 2, is it to do a calculation for each TF and put it into ranges to find the number of candlesticks?
Can't we just find out the date of the current timeframe and look through all values for the date, without determining the number of candles that have passed?
The number of intraday bars is simple to determine. For example for a 15 minute chart. Divide the number of minutes in one day by 15 (1440 / 15 = 96 bars or another PERIOD_D1/PERIOD_M15 = 96)
It is easy to determine the number of bars in a day. For example for 15 min chart. Divide the number of minutes in one day by 15 (1440 / 15 = 96 bars or another PERIOD_D1/PERIOD_M15 = 96).
I understand that mathematically, but how to do it with functions - that's the question! Suppose I get the current time using Time, and then how
I think to make a counter for each TF, with a new bar, which will be reset at the start of a new day, and reset to zero for a day maximum, and before that to do a comparison of each bar, but how to program it?
You should not do that! It should never be taken as a fact that the number of bars on any given day by TF will be the same!
Yes, for example there may be an early closing time on a Friday...
So you have to define the day, and take an array to find the maximum for the day without taking into account the number of candlesticks, how do you do that?
I understand that mathematically, but how to do it with functions - that's the question! Suppose I get the current time using Time, and then how
I think I should make a counter for each TF, with a new bar, which will be reset to zero in case of a new day. I want to reset it to zero for one day maximum and compare each bar before that; but how should I program it?
This is approximately how we can find the first bar corresponding to the beginning of the day.
This is roughly how to find the first bar corresponding to the start of the day.
For example we have this algorithm.
We have found the first bar - at the moment when it is formed this bar will be the high of the day. Then we get the next bar and check its maximum, if it is higher than the previous one, it means it is a new high of the day. And so on till the last bar of the day.