Highest High

 
 int     M1BarShiftOfTradeOpen     = iBarShift     (symbol, PERIOD_M1, Order_Open_Time, false                       );    
 int     IndexOfHigh               = iHighest      (symbol, PERIOD_M1, MODE_HIGH      , M1BarShiftOfTradeOpen + 1, 0);    
 double  HighestValue              = iHigh         (symbol, PERIOD_M1, IndexOfHigh                                  );   
 
 Print("Order_Open_Time:",TimeToStr(Order_Open_Time));
 Print("Order_Open_Time:",Order_Open_Time);
 Print("M1BarShiftOfTradeOpen:",M1BarShiftOfTradeOpen);
 Print("IndexOfHigh :",IndexOfHigh );
 Print("HighestValue :",HighestValue );

Hi, I am trying to find the highest high since the order opened and I am using this suggestion from jjc

https://forum.mql4.com/22224#165515


from the log I print

15:47:21 2005.01.14 07:17 Trend_Following EURUSD,Daily: Order_Open_Time:2005.01.12 14:52
15:47:21 2005.01.14 07:17 Trend_Following EURUSD,Daily: Order_Open_Time:1105541541
15:47:21 2005.01.14 07:17 Trend_Following EURUSD,Daily: M1BarShiftOfTradeOpen:0
15:47:21 2005.01.14 07:17 Trend_Following EURUSD,Daily: IndexOfHigh :-1
15:47:21 2005.01.14 07:17 Trend_Following EURUSD,Daily: HighestValue :0


How it is possible to for the M1BarShiftOfTradeOpen to be zero?

Many thanks

 
How it is possible to for the M1BarShiftOfTradeOpen to be zero?

Are you running on a M1 chart. Do you have M1 history that far back? My M1 history goes back 65000 bars (2.5 months)

Try specifying 0 instead of PERIOD_M1

 
WHRoeder:

Are you running on a M1 chart. Do you have M1 history that far back? My M1 history goes back 65000 bars (2.5 months)

Try specifying 0 instead of PERIOD_M1



It seems to work!


Thanks a lot WHRoeder

Reason: