break of previous day high low
shabaz:
Hi Guys,
Im tring to create an indicator to draw an arrow with a buffer on the chart for when the price crosses above the high or low of the previous day. but cant seem to get it to work, what am i doing wrong? Many Thanks in advance
for(int i = limit-1; i >= 0; i--) { if (i >= MathMin(5000-1, rates_total-1-50)) continue; //omit some old rates to prevent "Array out of range" or slow calculation int barshift_D1 = iBarShift(Symbol(), PERIOD_D1, Time[i]); if(barshift_D1 < 0) continue; //Indicator Buffer 1 RefreshRates(); if(Close[i] > iHigh(NULL, PERIOD_D1, 1+barshift_D1) //Price > Candlestick High ) { Buffer1[i] = Low[1+i]; //Set indicator value at Candlestick Low } else { Buffer1[i] = EMPTY_VALUE; } //Indicator Buffer 2 RefreshRates(); if(Close[i] < iLow(NULL, PERIOD_D1, 1+barshift_D1) //Price < Candlestick Low ) { Buffer2[i] = High[1+i]; //Set indicator value at Candlestick High } else { Buffer2[i] = EMPTY_VALUE; } } return(rates_total); }
Maybe this is what you want?
Hi Guys,
Im tring to create an indicator to draw an arrow with a buffer on the chart for when the price crosses above the high or low of the previous day. but cant seem to get it to work, what am i doing wrong? Many Thanks in advance