KING KELTER system code

rajatheroyal

Junior member
Messages
12
Likes
0
Hi guys , i was reading building winning trading sytems with tradestationbook there a code is given for King Kelter system but the code is not working can any body tell me why?
{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((High + Low + 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;
 
Looks like older EL code. Maybe this will work:

Inputs: avgLength(40), atrLength(40);
Vars: upBand(0),dnBand(0),liquidPoint(0),movAvgVal(0);
movAvgVal = Average((High + Low + Close),avgLength);
upBand = movAvgVal + AvgTrueRange(atrLength);
dnBand = movAvgVal - AvgTrueRange(atrLength);
if(movAvgVal > movAvgVal[1]) then Buy ("KKBuy") Next Bar at upBand stop;
if(movAvgVal < movAvgVal[1]) then Sell Short("KKSell") next bar at dnBand stop;
liquidPoint = movAvgVal;
If(MarketPosition = 1) then Sell next bar at liquidPoint stop;
If(MarketPosition = -1) then Buy to cover next bar at liquidPoint stop;
 
Is the code working now? If you get a signal on the chart, the code is working. Whether the startegy works that is another issue.

Also, it would be nice if you had started you reply as follows:

"Thank you, i tried that but its not working only the first signal is comming in chart. "

Saying a little thank you to someone who is trying to help you for free does not cost anything.
 
Oops :eek: i am extremely sorry.Actually i was in the irritation that the strategy was not working ,i forgot to say thank.It was my mistake.Thanks a lot for helping me out.
(also here there is no thanks button like other sites:innocent:)
 
The error is this: (High + Low + Close),avgLength), the exact code is this: (High + Low + Close)/3,avgLength)
so the complete and working code is this:

{King Keltner - by George Pruitt}

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

movAvgVal = Average((High + Low + Close)/3,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 Buytocover tomorrow at liquidPoint stop;
 
Last edited:
Top