_SECTION_BEGIN("PreviousOHLCandMP"); // Programmer: Alex Chambers, May 2007 // For use with the trading strategies at Kreslik.com // For Amibroker - just drag and drop // I, Alex Chambers, am not responsible for any results you may have from the use of this indicator // You must evaluate yourself the potential for gains AND losses // Please include this and/or any other comment description of any changes you make. startTim = Param("TimeOfOpen",130000,0,240000,500); doHLplot = Param("DoHandLalso?",1,0,1,1); doCOplot = Param("DoCandOalso?",1,0,1,1); MPplot = Param("DoMP?",1,0,1,1); ttt = IIf(TimeNum() == startTim,1,0); et = Ref(ttt,1); te = BarsSince(ttt)+1; aa = IIf(et==1,LLV(L,te),0); Ll = IIf(ttt==1,Ref(aa,-1),0); bb = IIf(et==1,HHV(H,te),0); Hh = IIf(ttt==1,Ref(bb,-1),0); pc = IIf(et==1,C,0); prevL = ValueWhen(ttt==1,Ll); prevH = ValueWhen(ttt==1,Hh); prevMP = (prevL + prevH) / 2; prevO = ValueWhen(ttt==1,O,2); prevC = ValueWhen(ttt==1,Ref(pc,-1)); if (doHLplot == 1) { Plot (prevL,"PrvL",colorRed, styleStaircase); Plot (prevH,"PrvH",colorRed, styleStaircase); } if (MPplot == 1) { Plot (prevMP,"PrvMP",colorYellow, styleStaircase); } if (doCOplot == 1) { Plot (prevO,"PrvO",colorBlue, styleStaircase); Plot (prevC,"PrvC",colorBlue, styleStaircase); } Candledir = IIf(PrevO>PrevC,0,1); a = VarGetText("Title"); a = a + WriteIf(Candledir==0," PREVIOUS_DAILY_CNDL: Red"," PREVIOUS_DAILY_CNDL: Green"); Title = a; _SECTION_END();