I need help regarding Lee Leibfarth's "Trading with an Adaptive Price Zone"

K

kmlsoni

Guest
#1
I have following program for Lee Leibfarth's "Trading with an Adaptive Price Zone" :-

// Adaptive Price Zone Indicator & System
////////////////////
function DblSmoothEMA(price,Length)
{
period = IIf (Length < 0, 1, sqrt(Length));
smooth = 2/(period+1);
return AMA(AMA(price,Smooth),smooth);
}

price = ParamField("Price");
period = Param("period", 20, 2, 100);
BandPct = Param("width[%]", 1.4, 0.1, 4, 0.1);

DsEMA = DblSmoothEMA(price,period);
RangeDsEMA = DblsmoothEMA(H-L,period);
Upband = BandPct * RangeDsEMA + DsEMA;
DnBand = DsEMA - BandPct * RangeDsEMA;

Plot(C, "Price", colorBlack, styleBar);
Plot(Upband, "UpBand", colorLightGrey);
Plot(DnBand, "DownBand", colorLightGrey
//you may uncomment lines below to get 'cloud' chart
//if you are using version 4.8 or higher
//PlotOHLC(UpBand, UpBand, DnBand, DnBand, "Band",
//ColorRGB(245,245,255), styleCloud);

SetTradeDelays(1,1,1,1)
ADXThshold = 30;
ADXValue = ADX(14);

Buy = ADXValue <= ADXThshold AND Low <= DnBand;
Short = ADXValue <= ADXThshold AND High <= UpBand;

Sell = Cover = ADXValue > ADXThshold;
if(Status("action") == actionIndicator)
{
Equity(2);
PlotShapes(Buy * shapeUpArrow, colorGreen, 0, DnBand, -24);
PlotShapes(Sell * shapeDownArrow, colorRed, 0, UpBand, -24);
PlotShapes(Short * shapeHollowDownArrow, colorRed, 0, UpBand, -24);
PlotShapes(Cover * shapeHollowUpArrow, colorGreen, 0, DnBand, -24);
}

I got few error messages any one can help me to rectify these error.
 
K

kmlsoni

Guest
#2
There are a couple of syntactical errors.

Add the missing code (marked in bold red) to the respective lines in the source code and it should fix the errors.


....
Plot(DnBand, "DownBand", colorLightGrey);
...
...
SetTradeDelays(1,1,1,1);
.....
Thanks Adheer
 

Similar threads