You can specify the timeframe in the call.
PERIOD_CURRENT
This will always be the chart timeframe.
If you want M15 then use
PERIOD_M15
You can specify the timeframe in the call.
This will always be the chart timeframe.
If you want M15 then use
unfortunately no difference.
i want a code to know the highest of "current day" till now in m15 chart or index of highest candle of today till this moment in current day in 15m chart. (it should be able to calculate the number of bars from 00:00 till this moment in 15m chart)
Bir Varzxorani: i want a code to find out the highest and lowest of the current day, but in 15m candles and with exception of current candle.
int highest=iHighest(_Symbol,PERIOD_CURRENT,MODE_HIGH,(hour*4)+minute,1)
-
Use SRC for code.
-
If you want to read the M15, use M15 not current.
-
Get the current date, first bar index of current date, find the highest.
datetime bod = date(); int iBod = iBarShift(_Symbol, PERIOD_M15, bod); int iHH = iHighest(_Symbol, PERIOD_M15, MODE_HIGH, iBod,1);
Find bar of the same time one day ago - MQL4 programming forum 2017.10.06
-
Use SRC for code.
-
If you want to read the M15, use M15 not current.
-
Get the current date, first bar index of current date, find the highest.
Find bar of the same time one day ago - MQL4 programming forum 2017.10.06
thanks Mr.Roeder, now works fine but i see that when hour is 0, sometimes again gives 23000. maybe its due system or mt5 structure problem.
and SRC is what?
-
Code button used to be called SRC.
Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum 2019.05.06
Messages Editor -
If the hour is zero, there is no completed bar one — you are asking for non-existant results.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
hey people, i got a simple code that instead of 0 gives me 23919 ! i want a code to find out the highest and lowest of the current day, but in 15m candles and with exception of current candle. but in this section i have a problem, when hour of day equals 0 it tries to go and find the highest and lowest of 23919 candles ago ! but when hour is higher than 0, it works fine.
MqlDateTime current;
int m=0;TimeCurrent(current);
int hour=current.hour;
int minute=current.min;
if(minute==0)
m=0;
if( minute ==15)
m=1; < you can forget these ifs.
if( minute ==30)
m=2;
if( minute ==45)
m=3;
int highest=iHighest(_Symbol,PERIOD_CURRENT,MODE_HIGH,(hour*4)+minute,1); <with this line i find the index of highest candle in 15m chart (every hour has 4 candles and i add 1 more per 15 minute)
int lowest=iLowest(_Symbol,PERIOD_CURRENT,MODE_LOW,(hour*4)+ minute,1);
thanks