/*[[ Name := VolaChai Author := Bheurekso Link := http://www.darmasdt.com/ Notes := Volatility Chaikin Separate Window := Yes First Color := Lime First Draw Type := Histogram First Symbol := 217 Use Second Data := Yes Second Color := Red Second Draw Type := Histogram Second Symbol := 218 ]]*/ Input : VCperiod(10), EMAperiod(10), JmlGaris(2); Variable : shift(0); Variable : HLA(0), VCh(0), VolCh(0), LoopAnjing(0), PrevBars(0), Pertama(true); SetLoopCount(0); If Bars < PrevBars Or Bars-PrevBars>1 Then Pertama = True; Prevbars = Bars; If Pertama Then { LoopAnjing = Bars-EMAperiod-VCperiod-1; If Loopanjing < 0 Then Exit; for shift = bars downto LoopAnjing+1 { SetIndexValue(shift,0); }; Pertama = False; }; LoopAnjing +=1; For shift=LoopAnjing Downto 0 { HLA = iMAEx(EMAperiod,MODE_EMA,0,PRICE_HIGH,shift)-iMAEx(10,MODE_EMA,0,PRICE_LOW,shift); VCh = iMAEx(EMAperiod,MODE_EMA,VCperiod,PRICE_HIGH,shift)-iMAEx(EMAperiod,MODE_EMA,VCperiod,PRICE_LOW,shift); VolCh = ((HLA - VCh) / VCh) * 100; If JmlGaris=2 then { if VolCh > 0 then { SetIndexValue(shift, VolCh); SetIndexValue2(shift,0); } else { SetIndexValue(shift,0); SetIndexValue2(shift,Volch); }; } else { SetIndexValue(shift,VolCh); SetIndexValue2(shift,0); }; LoopAnjing -= 1; };