Draw two horizontal lines with indicator's max and min of the day before.

 

Hi,

I'm looking for information about how could I create an indicator that draws two horizontal lines with the maximum and minimum of the previous day indicator's data.  The indicator is Awesome Oscilator. Also I would like to be like some pivot indicators, that draw all the chart, not just the last day.

Can anyone help me?

Thanks! 

 
  1. Take the AO and add two additional buffers
  2. For the given bar. Find the beginning of the day index
  3. Find the highest AO from beginning to current.
  4. Set the high buffer to that value.
#define HR2400 86400       // 24 * 3600
int      TimeOfDay(datetime when){  return( when % HR2400            );    }
datetime DateOfDay(datetime when){  return( when - TimeOfDay(when)   );    }
/////// in the for(ibar to 0) loop (after AO[iBar] calculated):
datetime barTime = Time[iBar],
         bodTime = DateOfDay(barTime);
int      iBod = iBarShift(NULL,0, bodTime),
         iHH  = ArrayMaximum( AO, iBod - iBar + 1, iBar);
double   HH   = AO[iHH];
while(iBod >= iBar){ AOhigh[iBod] = HH; iBod--; }
 

Thanks WHRoeder. I'll try with this!

 

Thx again! 

Reason: