/*[[ Name := Average Price Volatility Indicator Author := hapsa Link := http://www.metaquotes.net/ Separate Window := Yes First Color := Cyan First Draw Type := Line First Symbol := 217 Use Second Data := No Second Color := Red Second Draw Type := Line Second Symbol := 218 ]]*/ Input : prd(5); Variable : shift(0); Variable : apvi(0), n(0), sigma(0); SetLoopCount(0); For shift=Bars-1 Downto 0 Begin sigma=H[shift]-L[shift]; For n=1 to prd-1 Begin sigma=sigma+H[shift+n]-L[shift+n]; End; apvi=sigma/prd; SetIndexValue(shift, apvi); End;