Hi, I'm trying to get time from specific candle like highest price from last 52 candles but it gives me incorrect time, can anyone help me?
Here's my code:
Thanks in advance
You will not get time from a double value....
Use the built in functions
iHighest will return the index of the highest bar in the range specified
iTime will return the time of the bar with the specified index

- www.mql5.com
You will not get time from a double value....
Use the built in functions
iHighest will return the index of the highest bar in the range specified
iTime will return the time of the bar with the specified index
I know iHighest and iTime but I don't know how to find which candle is the highest in range to specify in iTime. I mean if 31th is the highest in last 52 candles than I will use that number in iTime
The high of the weekly candle is already the highest of that week.
iHighest will return the bar index number which you can use in iTime also.
I know iHighest and iTime but I don't know how to find which candle is the highest in range to specify in iTime. I mean if 31th is the highest in last 52 candles than I will use that number in iTime
int iHi = iHighest(_Symbol,_Period,MODE_HIGH,52,0); datetime dtTime = iTime(_Symbol,_Period,iHi); Print("Bar Index: " + iHi + " Time: " + dtTime);
If someone would need it, here's the code:
int r52wHn = iHighest( NULL, PERIOD_W1, MODE_HIGH, 52); //52 Week's Highest Candle int r52wLn = iLowest( NULL, PERIOD_W1, MODE_LOW, 52); //52 Week's Lowest Candle double r52wH = iHigh(_Symbol, PERIOD_W1, iHighest( _Symbol, PERIOD_W1, MODE_HIGH, 52)); //52 Week's Highest Price double r52wL = iLow(_Symbol, PERIOD_W1, iLowest( _Symbol, PERIOD_W1, MODE_LOW, 52)); //52 Week's Lowest Price string r52wHt = StringSubstr(TimeToStr(iTime(Symbol(),PERIOD_W1,r52wHn)), 0, 10); //Show Date only string r52wLt = StringSubstr(TimeToStr(iTime(Symbol(),PERIOD_W1,r52wLn)), 0, 10); //Without Time SetLabel2 ("trtdg2", r52wHt + " " + r52wH, "Arial", WColor, 195, 60, CsymTp, 10, 3, ANCHOR_LEFT_LOWER); SetLabel2 ("trtdg3", r52wLt + " " + r52wL, "Arial", WColor, 195, 40, CsymTp, 10, 3, ANCHOR_LEFT_LOWER);
Marco and Paul Thanks for your suggestions

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi, I'm trying to get time from specific candle like highest price from last 52 candles but it gives me incorrect time, can anyone help me?
Here's my code:
Thanks in advance