/*[[ Name := NRTR Author := VG many thanks to Konkop and dupidu Link := 4vg@mail.ru Separate Window := No First Color := Fuchsia First Draw Type := Line First Symbol := 159 Use Second Data := Yes Second Color := Aqua Second Draw Type := Line Second Symbol := 159 ]]*/ //----------------------------------------------------------------------- Input : AveragePeriod(10); //---------------------------------------------------------------------- Variable : bar(0); Variable : value(0); Variable : price(0); Variable : trend(0),dK(0), AvgRange(0),i(0); SetLoopCount(0); AvgRange=0; for i=1 To AveragePeriod { AvgRange+= Abs(High[i]-Low[i]); }; // Fixed to work with JPY symbols if Point>=0.01 then dK = (AvgRange/AveragePeriod)*Point else dK = (AvgRange/AveragePeriod); if Close[Bars-1] > Open[Bars-1] then { value = Close[Bars - 1] * (1 - dK); trend = 1; SetIndexValue2(Bars - 1, value); }; if Close[Bars-1] < Open[Bars-1] then { value = Close[Bars - 1] * (1 + dK); trend = -1; SetIndexValue(Bars - 1, value); }; for bar = Bars - 2 downto 0 { if trend >= 0 then { if Close[bar] > price then price = Close[bar]; value = price * (1 - dK); if Close[bar] < value then { price = Close[bar]; value = price * (1 + dK); trend = -1; }; } else if trend <= 0 then { if Close[bar] < price then price = Close[bar]; value = price * (1 + dK); if Close[bar] > value then { price = Close[bar]; value = price * (1 - dK); trend = 1; }; }; if trend = -1 then { SetIndexValue(bar, value); SetIndexValue2(bar, -1); } if trend = 1 then { SetIndexValue2(bar, value); SetIndexValue(bar, -1); } }; // ----------------------