Hi there!
I am having a difficulty understanding the following easylanguage code so I hope you can help me. The code instructs TS to buy when the moving average slopes up or down at an upper/lower band but in fact the trades are initiated even if the price doesn’t reach these bands – as if shown at the picture that I attached. I wonder what is the purpose of this upBand and dnBand functions. Looking forward to your help!
The code:
thanks!
I am having a difficulty understanding the following easylanguage code so I hope you can help me. The code instructs TS to buy when the moving average slopes up or down at an upper/lower band but in fact the trades are initiated even if the price doesn’t reach these bands – as if shown at the picture that I attached. I wonder what is the purpose of this upBand and dnBand functions. Looking forward to your help!
The code:
Code:
{King Keltner by George Pruitt—based on trading system presented by Chester
Keltner}
Inputs: avgLength(40), atrLength(40);
Vars: upBand(0),dnBand(0),liquidPoint(0),movAvgVal(0);
movAvgVal = Average(Close,avgLength);
upBand = movAvgVal + AvgTrueRange(atrLength);
dnBand = movAvgVal - AvgTrueRange(atrLength);
if(movAvgVal > movAvgVal[1]) then Buy ("KKBuy") tomorrow at upBand stop;
if(movAvgVal < movAvgVal[1]) then Sell Short("KKSell") tomorrow at dnBand
stop;
liquidPoint = movAvgVal;
If(MarketPosition = 1) then Sell tomorrow at liquidPoint stop;
If(MarketPosition = -1) then Buy To Cover tomorrow at liquidPoint stop;
thanks!