How to get a time of High/Low of previous day?

Back to topics list To post a new topic, please log in or register
avatar
7
marky_74 2012.10.30 00: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? 

 
avatar
14167
RaptorUK 2012.10.30 10: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()

 
avatar
12995
WHRoeder 2012.10.30 13: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];

 
avatar
7
marky_74 2012.10.30 13: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:)  

avatar
2
sssolepro 2015.05.05 03: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.
avatar
Moderator
3416
GumRai 2015.05.05 03: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.
Back to topics list  

To add comments, please log in or register