Correct King Keltner Easy Language

Several have brought it to my attention that the King Keltner code in the book is missing a couple of lines. Here’s the complete code in its entirety. Thanks for bringing this to my attention.



[LegacyColorValue = true]; 

{King Keltner Program
King Keltner by George Pruitt -- based on trading system presented by Chester Keltner
 -- an example of a simple, robust and effective strategy}

Inputs: avgLength(40),atrLength(40);
Vars: upBand(0),dnBand(0),liquidPoint(0),movAvgVal(0);

movAvgVal = average((h+l+c)/3,avgLength);

upBand = movAvgVal + AvgTrueRange(atrLength);
dnBand = movAvgVal - AvgTrueRange(atrLength);

{Remember buy stops are above the market and sell stops are below the market
 -- if the market gaps above the buy stop, then the order turns into a market order
 vice versa for the sell stop}

if(movAvgVal > movAvgVal[1]) then Buy ("KKBuy") tomorrow at upBand stop;
if(movAvgVal < movAvgVal[1]) then SellShort("KKSell")tomorrow at dnBand stop;

liquidPoint = movAvgVal;
 
if(MarketPosition = 1) then Sell tomorrow at liquidPoint stop;
if(MarketPosition =-1) then BuyTocover tomorrow at liquidPoint stop;