PureBytes Links
Trading Reference Links
|
Andy, I hope you haven't gotten mad and quit the list. Anyway I think
your code is interesting. I did a copy/paste so those without TS4 can
take a look.
The F2 function is an interesting momentum calc... similar to Kaufman's
efficiency ratio.
The buy/sell levels are interesting too. Andy is calculating Keltner
channels. When price breaks the upper channel, he bumps his buy and sell
levels up. Opposite for the lower channel.
Let's hear it people... finally something interesting to talk about.
--
Dennis
---------------
{Andy's F2 Function}
Input: R(Numeric),S(Numeric);
If (Close-Close[1])<>0 then
F2 = Xaverage(Xaverage(Close-Close[1],R),S)/
XAverage(Xaverage(AbsValue(Close-Close[1]),R),S)*100
else F2=F2[1];
---------------
{Andy's Jail Break System}
Inputs: Len(9),Pct(.8),R(21),S(12),Q(4),LvlB(-30),LvlS(30),Shift(5);
Vars: CLine(0),AvgRange(0),Upper(0),Lower(0),Mo(0),Avg(0),lvb(0),lvs(0);
CLine=XAverage(Close,Len);
AvgRange=XAverage(TrueRange,Len);
Upper=CLine+AvgRange*Pct;
Lower=CLine-AvgRange*Pct;
Mo=F2(R,S);
Avg=Xaverage(F2(R,S),Q);
If Close crosses above Upper then begin
lvb=lvlb+Shift;
lvs=lvls+shift;
end;
If Close crosses below Lower then begin
lvb=lvlb-shift;
lvs=lvls-shift;
end;
If mo crosses above LvB then buy 1 contract at close;
If mo crosses below avg then exitlong all contracts at close;
If mo crosses below LvS then sell 1 contract at close;
if mo crosses above avg then exitshort all contracts at close;
--------------
{Andy's Jail Break Indicator}
Inputs:Len(10),pct(.8),R(21),S(12),Lvlb(-30),Lvls(30),Shift(5);
Vars: CentLine(0), AvgRange(0), Upper(0), Lower(0),mo(0),lvb(0),lvs(0);
CentLine=Average(Close,Len);
AvgRange=Average(TrueRange,Len);
Upper=CentLine+(AvgRange*pct);
Lower=CentLine-(AvgRange*pct);
Mo=F2(R,S);
If close crosses above Upper then begin
Lvb=Lvlb+Shift;
Lvs=Lvls+shift;
end;
If close crosses below Lower then begin
Lvb=Lvlb-shift;
Lvs=Lvls-shift;
end;
Plot1(Mo,"Momentum");
Plot2(Lvb,"LvlBuy");
Plot3(Lvs,"LvlSell");
Plot4(0,"Zero");
|