Hi,
I am trying to calculate the lowest value between two values in the same array. In the code below, I want the lowest point b/w pvthi and pvthi[1] and likewise highest point b/w pvtlo and pvtlo[1]
I tried the following code. It doesnt seem to work. Can you help rectify it?
_SECTION_BEGIN("PvtLoHi");
pvthi = Ref(Low,2) < Low AND Ref(Low,1) < Low AND Ref(Close,2) < Close AND Ref(Close,1) < Close;
pvtlo = Ref(High,2) > High AND Ref(High,1) > High AND Ref(Close,2) > Close AND Ref(Close,1) > Close;
pvthit = pvthi;
pvtlot = pvtlo;
pvthi = pvthit AND H == HighestSince(pvtlot, H);
pvtlo = pvtlot AND L == LowestSince(pvthit, L);
pvthit = pvthi;
pvtlot = pvtlo;
pvtlo = ExRem( Reverse(pvtlot), Reverse(pvthit));
pvthi = ExRem( Reverse(pvthit), Reverse(pvtlot));
pvtlo = Reverse ( pvtlo );
pvthi = Reverse(pvthi);
// This is the place where I am trying to get the highest and lowest values. It doesn't seem to work
pvthighest = Valuewhen(pvtlo , HighestSince(pvtlo, H), 0);
pvtlowest = Valuewhen(pvthi , LowestSince(pvthi, L), 0);
lpht = Cross(pvtlo, C);
lplt = Cross(C, pvthi);
//lph = Valuewhen(lplt, HighestSince(lplt, H,1), 1);
PlotShapes(pvtlowest * shapeUpArrow, colorRed,0,Low);
PlotShapes(pvthighest * shapeDownArrow, colorGreen,0,High);
//PlotShapes(lph * shapeDownTriangle, colorGreen,0,High);
//PlotShapes(lpl * shapeUpTriangle, colorRed,0,Low);
Plot(C,"Close",colorRed,styleCandle);
_SECTION_END();