How to get the time of highest price?

 

I know to get the highest price

    int bar_index=iHighest(symbol,PERIOD_W1,MODE_HIGH,0,0);
    double hg=iHigh(symbol,PERIOD_W1,bar_index);
    datetime bar_time=iTime(symbol,PERIOD_W1,bar_index)

bar_time is the time of the candle

but I need the time of the high price 

 
Avi: I know to get the highest price. bar_time is the time of the candle. but I need the time of the high price 

To find the exact time of the high of a bar, you would have to find the highest M1 bar during the period of the higher time-frame.

If M1 is still too coarse, then you would have to scan the tick data for that M1 bar to find the highest and the respective time.

 

Thank you

Ok I got the highest M1 bar

Now, how can I scan the tick data to find thr exact time of highest price?

 
Avi:

I know to get the highest price

bar_time is the time of the candle

but I need the time of the high price 

First you need to check if there is ticks (Bid / Ask) available on your chart.

then choose your desired timeframe e.g. M1 or M15 or Tick e.g. 100 ticks, 500 ticks etc

then scan it same way you have posted code, change 

PERIOD_W1

to your desired period.

if your chosen period is in ticks you can study

https://www.mql5.com/en/docs/series/copyticksrange

Documentation on MQL5: Timeseries and Indicators Access / CopyTicksRange
Documentation on MQL5: Timeseries and Indicators Access / CopyTicksRange
  • www.mql5.com
CopyTicksRange - Timeseries and Indicators Access - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Arpit T #:

First you need to check if there is ticks (Bid / Ask) available on your chart.

then choose your desired timeframe e.g. M1 or M15 or Tick e.g. 100 ticks, 500 ticks etc

then scan it same way you have posted code, change 

to your desired period.

if your chosen period is in ticks you can study

https://www.mql5.com/en/docs/series/copyticksrange

Thank you