Effort Index Indicator

#1
Hello fellow traders! I have this indicator here that measures the effort+results on each individual bar which is really useful for volume-based strategies- I use it for VSA. Tried uploading it to my chart but it reflected errors. Can anyone here who can fix this code? Thanks!

Here's the code:

//Volume Price Analysis - Effort Verus Result Index Afl - Version 1.0
// Afl by Karthikmarar
// www.karthikmarar.blogspot.com
//============================================================
_SECTION_BEGIN("Effort versus Result - V.1.0");
//SetChartBkColor(colorWhite);
SetChartOptions(0,chartShowArrows|chartShowDates);
Vlp = Param("Volume lookback period",40,20,200,10);
Vrg = MA(V,Vlp);// average volume
rg = (H-L); //Spread
arg = Wilders(rg,Vlp);//Average Spread
rs = abs(C-Ref(C,-1));//Result
rsg = Wilders(rs,Vlp);//Average Result
sro = rg/arg;//ratio of spread to average
Vro = V/Vrg;//ratio of volume to average
rso = rs/rsg; //ratio of result to average
smax = HHV(sro,Vlp);
smin = LLV(sro,Vlp);
Vmax = HHV(Vro,Vlp);
Vmin = LLV(Vro,Vlp);
rmax = HHV(rso,Vlp);
RMIn = LLV(rso,Vlp);
snor = (sro - smin)*100/(smax-Smin);
Vnor = (Vro - Vmin)*100/(Vmax-Vmin);
rnor = (rso - RMIn)*100/(rmax-RMIn);
EI = rnor/Vnor;

SelectedIndicator = ParamList( "Show", "Raw Effort-Result,Effort Index", 1 );
SelectedResult = ParamList( "Select", "Spread,Bar to Bar", 1 );
switch ( SelectedIndicator )
{
case "Raw Effort-Result":
switch ( SelectedResult )
{

case "Spread":
SetBarFillColor( colorOrange );
PlotOHLC(0,snor,0,snor,"Result",IIf(C>Ref(C,-1),colorLime,colorRed), styleCandle |styleThick) ;
Plot(MA(snor,Vlp),"Avg Result",colorYellow,1|styleDashed|styleThick);
SetBarFillColor( colorGreen );
PlotOHLC(0,-Vnor,0,-Vnor,"Effort",IIf(C>Ref(C,-1),colorLime,colorRed), styleCandle|styleThick ) ;
Plot(MA(-Vnor,Vlp),"Avg Effort",colorTurquoise,1|styleDashed|styleThick);
break;
case "Bar to Bar":
SetBarFillColor( colorOrange );
PlotOHLC(0,rnor,0,rnor,"Result",IIf(C>Ref(C,-1),colorLime,colorRed), styleCandle |styleThick) ;
Plot(MA(rnor,Vlp),"Avg Result",colorYellow,1|styleDashed|styleThick);
SetBarFillColor( colorGreen );
PlotOHLC(0,-Vnor,0,-Vnor,"Effort",IIf(C>Ref(C,-1),colorLime,colorRed), styleCandle|styleThick ) ;
Plot(MA(-Vnor,Vlp),"Avg Effort",colorTurquoise,1|styleDashed|styleThick);

break;
}
break;
case "Effort Index":
SetBarFillColor( colorGreen );
PlotOHLC(0,EI,0,EI,"Effort Index",colorTurquoise, styleCandle|styleThick ) ;
break;
}
_SECTION_END();
 

Similar threads