I'm experimenting on a simple type volatility formula and the results I get from an exploration leaves me with numerous zeros in the results.
Anyone know how to overcome this?
With the lookback period set to say a fixed period of example 300 days, I still get this issue, therefore I doubt the lookback period formula is the issue.
// THIS FORMULA EXPERIMENTING WITH VOLATILITY
VT1 = Cum(Nz(DateNum()>=1160127)); // MAX LOOKBACK DATE
VT2 = IIf(-20+(BarIndex())<VT1,-20+(BarIndex()),VT1); // ADJUSTED LOOKBACK TIME
MA20 = MA(C,20);
VT3 = MA20>Ref(MA20,-1); // RISING MA20
VT4 = Sum(VT3,VT2); // SUM OF RISING MA20
VT5 = H>MA20;
VT6 = L>MA20;
VT7 = L<MA20;
VT8 = IIf(VT3,Sum(VT5,VT4),0); // SUM OF H>MA20
VT9 = IIf(VT3,Sum(VT6,VT4),0); // SUM OF L>MA20
VT10 = IIf(VT3,Sum(VT7,VT4),0); // SUM OF L<MA20
Filter = 1;
AddColumn(VT8,"VT8",1,1,10,50);
AddColumn(VT9,"VT9",1,1,10,50);
AddColumn(VT10,"VT10",1,1,10,50);
Anyone know how to overcome this?
With the lookback period set to say a fixed period of example 300 days, I still get this issue, therefore I doubt the lookback period formula is the issue.
// THIS FORMULA EXPERIMENTING WITH VOLATILITY
VT1 = Cum(Nz(DateNum()>=1160127)); // MAX LOOKBACK DATE
VT2 = IIf(-20+(BarIndex())<VT1,-20+(BarIndex()),VT1); // ADJUSTED LOOKBACK TIME
MA20 = MA(C,20);
VT3 = MA20>Ref(MA20,-1); // RISING MA20
VT4 = Sum(VT3,VT2); // SUM OF RISING MA20
VT5 = H>MA20;
VT6 = L>MA20;
VT7 = L<MA20;
VT8 = IIf(VT3,Sum(VT5,VT4),0); // SUM OF H>MA20
VT9 = IIf(VT3,Sum(VT6,VT4),0); // SUM OF L>MA20
VT10 = IIf(VT3,Sum(VT7,VT4),0); // SUM OF L<MA20
Filter = 1;
AddColumn(VT8,"VT8",1,1,10,50);
AddColumn(VT9,"VT9",1,1,10,50);
AddColumn(VT10,"VT10",1,1,10,50);
