Hi,
Can someone help me Please to fix the warning error 505 in this code so there is no division by 0 for the TR
The indicator is the volatility quality index.
Here is the code
SECTION_BEGIN("VOLATILITYQINDEX");
//Translated by Vic Huebner
//True range is the greatest of H-L,Ref(C,-1)-H, or Ref(C,-1)-L
TR=ATR(1);
//Volatility quality index is the ratio of C-O compared to H-L. The higher the better.
VQI=((C-Ref(C,-1)))/TR + (C - O)/(H-L)*.5;
//Stridsman made it more sensitive by including the price changes
VQI=abs(VQI)*(C-Ref(C,-1)+(C-O))*.5;
SumVQI=Cum(VQI);
MaxGraph=4;
//VQI ranges between -1 and +1. It was offset to make it compatible with the zig function.
Graph0=100*(SumVQI+100); //Red line
Graph1=100*(MA(SumVQI,9)+100); //blue - 9 day moving average
Graph2=100*(MA(SumVQI,200)+100); //black line - 200 day MA
Graph2Style=1;
Graph3Style=1;
Graph3=Zig(Graph0,1); //yellow line indicates trend change
Graph3Color=7;
_SECTION_END();
tks a lot
Can someone help me Please to fix the warning error 505 in this code so there is no division by 0 for the TR
The indicator is the volatility quality index.
Here is the code
SECTION_BEGIN("VOLATILITYQINDEX");
//Translated by Vic Huebner
//True range is the greatest of H-L,Ref(C,-1)-H, or Ref(C,-1)-L
TR=ATR(1);
//Volatility quality index is the ratio of C-O compared to H-L. The higher the better.
VQI=((C-Ref(C,-1)))/TR + (C - O)/(H-L)*.5;
//Stridsman made it more sensitive by including the price changes
VQI=abs(VQI)*(C-Ref(C,-1)+(C-O))*.5;
SumVQI=Cum(VQI);
MaxGraph=4;
//VQI ranges between -1 and +1. It was offset to make it compatible with the zig function.
Graph0=100*(SumVQI+100); //Red line
Graph1=100*(MA(SumVQI,9)+100); //blue - 9 day moving average
Graph2=100*(MA(SumVQI,200)+100); //black line - 200 day MA
Graph2Style=1;
Graph3Style=1;
Graph3=Zig(Graph0,1); //yellow line indicates trend change
Graph3Color=7;
_SECTION_END();
tks a lot
VQI indicator warning 505 error
Aucun commentaire:
Enregistrer un commentaire