PureBytes Links
Trading Reference Links
|
Here's the code of a breakout trading system using SlowK with adaptive
selling/ buying levels. It's not a complete system but I believe that someone
out there can take this to another level.
{system: Jail break SlowK}
Inputs: Len(21),pct(.7),R(21),Lvlb(3.5),Lvls(5),Shift(.5),Ncontr(1);
Vars: CLine(0),AvgRange(0),Upper(0),Lower(0);
Vars: Mo(0),Avg(0),Lvb(0),Lvs(0),Lb(0),Ls(0);
Cline=Xaverage(Close,Len);
AvgRange=Xaverage(TrueRange,Len);
Upper=Cline + AvgRange*Pct;
Lower=Cline - AvgRange*Pct;
Mo=SlowK(R);
Avg=SlowD(R);
Lb=Lvlb*10;
Ls=Lvls*10;
If Close crosses above Upper then lvs=Ls-shift;
If Close crosses below Lower then lvb=Lb+shift;
If Mo crosses above Lvb then buy ncontr contracts at close;
If Mo crosses below Avg then exitlong all contracts at close;
If Mo crosses below Lvs then sell ncontr contracts at close;
If Mo crosses above Avg then exitshort all contracts at close;
{code for System Jailbreak SlowK ends}
Notes: Lvlb and Lvls are under 10 because it allows one to optimize the system
without changing the maxbarsback from 50 to 100 if we were to use the normal
stochastic routine. Later in the code they were multiply by ten to bring them
back to normal (lb and ls). A new thought in this system: whenever the
stochastics are way overbought, they have a tendency to stay in the overbought
territory for a while. By shifting the sell zone lower, we don't sell short
prematurely. However, this leaves the exit conditons a lot to be desired (some
one else can play with this). Again, the same can be expected when the SlowK
is way oversold. We don't want
to enter the long trade prematurely. Something else: Ncontr specifies the
number of contracts to be traded. Another way of doing this is to start off
with 1 contract and pyramid your way up: create a Variable with the name Temp,
a new input called Mrgn (to input the margin requiement per contract) and
another input to limit the maximum contracts the market is liquid for or
you're confortable with call Mxcntrr.
Temp=netprofit/mrgn;
If temp >1 then begin
if temp>1 and temp<Mxcntr then ncontr=temp;
if temp> mxcntr then ncontr=mxcntr;
end;
Of course, we have to move "ncontr" from inputs to vars.
Results of a 60 min S&P March contract are attached.
Jail Break Slowk SP H8-60 min 11/17/97 - 02/26/98
Performance Summary: All Trades
Total net profit $ 27540.00 Open position P/L $ 0.00
Gross profit $ 33010.00 Gross loss $ -5470.00
Total # of trades 17 Percent profitable 76%
Number winning trades 13 Number losing trades 4
Largest winning trade $ 7920.00 Largest losing trade $ -2030.00
Average winning trade $ 2539.23 Average losing trade $ -1367.50
Ratio avg win/avg loss 1.86 Avg trade(win & loss) $ 1620.00
Max consec. winners 10 Max consec. losers 1
Avg # bars in winners 11 Avg # bars in losers 3
Max intraday drawdown $ -3335.00
Profit factor 6.03 Max # contracts held 1
Account size required $ 15335.00 Return on account 180%
Performance Summary: Long Trades
Total net profit $ 20380.00 Open position P/L $ 0.00
Gross profit $ 21210.00 Gross loss $ -830.00
Total # of trades 9 Percent profitable 89%
Number winning trades 8 Number losing trades 1
Largest winning trade $ 7920.00 Largest losing trade $ -830.00
Average winning trade $ 2651.25 Average losing trade $ -830.00
Ratio avg win/avg loss 3.19 Avg trade(win & loss) $ 2264.44
Max consec. winners 5 Max consec. losers 1
Avg # bars in winners 11 Avg # bars in losers 4
Max intraday drawdown $ -2125.00
Profit factor 25.55 Max # contracts held 1
Account size required $ 14125.00 Return on account 144%
Performance Summary: Short Trades
Total net profit $ 7160.00 Open position P/L $ 0.00
Gross profit $ 11800.00 Gross loss $ -4640.00
Total # of trades 8 Percent profitable 63%
Number winning trades 5 Number losing trades 3
Largest winning trade $ 4895.00 Largest losing trade $ -2030.00
Average winning trade $ 2360.00 Average losing trade $ -1546.67
Ratio avg win/avg loss 1.53 Avg trade(win & loss) $ 895.00
Max consec. winners 5 Max consec. losers 3
Avg # bars in winners 12 Avg # bars in losers 3
Max intraday drawdown $ -4810.00
Profit factor 2.54 Max # contracts held 1
Account size required $ 16810.00 Return on account 43%
Jail Break Slowk SP H8-60 min 11/17/97 - 02/26/98
Date Time Type Cnts Price Signal Name Entry P/L Cumulative
12/01/97 11:30am Buy 1 981.50
12/01/97 3:30pm LExit 1 985.10 $ 745.00 $ 745.00
12/09/97 3:30pm Sell 1 990.00
12/10/97 4:15pm SExit 1 982.00 $ 1845.00 $ 2590.00
12/15/97 12:30pm Buy 1 969.80
12/16/97 3:30pm LExit 1 977.30 $ 1720.00 $ 4310.00
12/18/97 10:30am Sell 1 968.70
12/19/97 12:30pm SExit 1 948.50 $ 4895.00 $ 9205.00
12/19/97 4:15pm Buy 1 957.20
12/22/97 1:30pm LExit 1 958.50 $ 170.00 $ 9375.00
12/22/97 1:30pm Sell 1 958.50
12/29/97 10:30am SExit 1 957.80 $ 20.00 $ 9395.00
12/29/97 10:30am Buy 1 957.80
12/31/97 11:30am LExit 1 978.70 $ 5070.00 $ 14465.00
01/06/98 10:30am Sell 1 977.20
01/07/98 2:30pm SExit 1 964.50 $ 3020.00 $ 17485.00
01/12/98 1:30pm Buy 1 943.00
01/15/98 12:30pm LExit 1 959.20 $ 3895.00 $ 21380.00
01/22/98 12:30pm Sell 1 969.90
01/23/98 2:30pm SExit 1 961.20 $ 2020.00 $ 23400.00
01/26/98 11:30am Buy 1 965.00
01/26/98 3:30pm LExit 1 962.30 $ -830.00 $ 22570.00
01/26/98 4:15pm Buy 1 963.70
01/29/98 1:30pm LExit 1 996.00 $ 7920.00 $ 30490.00
02/05/98 12:30pm Sell 1 1006.50
02/05/98 4:15pm SExit 1 1009.80 $ -980.00 $ 29510.00
02/05/98 4:15pm Buy 1 1009.80
02/09/98 10:30am LExit 1 1015.20 $ 1195.00 $ 30705.00
02/12/98 11:30am Sell 1 1012.70
02/12/98 2:30pm SExit 1 1020.20 $ -2030.00 $ 28675.00
02/12/98 2:30pm Buy 1 1020.20
02/13/98 12:30pm LExit 1 1022.80 $ 495.00 $ 29170.00
02/20/98 12:30pm Sell 1 1027.20
02/20/98 2:30pm SExit 1 1033.10 $ -1630.00 $ 27540.00
|