Download MetaTrader 5
To add comments, please log in or register
Learn operation principles of Trading Signals for MetaTrader.
Marky
27
Marky 2012.10.29 23:53 

Hi,

I'm trying to automate analizing charts and to develop some tools for that purpose.

But I can't find a time (lets say an Hour) of High/Low of previous day on the H1 chart.

I used iHigh and iLow functions to find extremes on a D1 chart, but I have no idea how to find a particular time of them. :(

Do you have any idea how to do it? 

Simon Gniadkowski
Moderator
17963
Simon Gniadkowski 2012.10.30 09:12  
marky_74:

Hi,

I'm trying to automate analizing charts and to develop some tools for that purpose.

But I can't find a time (lets say an Hour) of High/Low of previous day on the H1 chart.

I used iHigh and iLow functions to find extremes on a D1 chart, but I have no idea how to find a particular time of them. :(

Do you have any idea how to do it? 

Use iHighest() & iLowest() to get the bar numbers of the High and Low bars and then you can use Time[bar_number] or iTime()
whroeder1
13624
whroeder1 2012.10.30 12:46  
marky_74:
But I can't find a time (lets say an Hour) of High/Low of previous day on the H1 chart.
I used iHigh and iLow functions to find extremes on a D1 chart, but I have no idea how to find a particular time of them. :(
  1. As long has you have D1 history (for the tester, and handle ERR_HISTORY_WILL_UPDATED for live) you can use:
    double HHyest = iHigh(NULL, PERIOD_D1, 1);

  2. Alternatively, (for offline charts, etc)
    #define HR2400      86400           // 24 * 3600
    datetime TimeOfDay(datetime when){  return( when % HR2400          );       }
    datetime DateOfDay(datetime when){  return( when - TimeOfDay(when) );       }
    //////
    datetime  now   = TimeCurrent(),
             bod    = DateOfDay(now),
             yest   = DateOfDay(bod-1);
    int      iBod   = iBarShift(NULL,0, bod),
             iYest  = iBarShift(NULL,0, yest),
             iHHy   = iHighest(NULL,0,MODE_HIGH, iYest-iBod, iBod+1);
    double   HHyest = High[iHighest];

Marky
27
Marky 2012.10.30 12:52  
RaptorUK:
Use iHighest() & iLowest() to get the bar numbers of the High and Low bars and then you can use Time[bar_number] or iTime()


Thanks a lot :)

Nice idea. I tried it and it works:)  

Marcus Roberts
139
Marcus Roberts 2015.05.05 01:16  
Can give an idea of how to stop iHighest/iLowest  from giving a signal past the last higest/lowest, ie... lowest on an uptrend? Any help would be much appreciated. Thanks.
Keith Watford
Moderator
7950
Keith Watford 2015.05.05 01:57  
sssolepro:
Can give an idea of how to stop iHighest/iLowest  from giving a signal past the last higest/lowest, ie... lowest on an uptrend? Any help would be much appreciated. Thanks.
I don't understand what you are asking for.
/
To add comments, please log in or register