PureBytes Links
Trading Reference Links
|
Gary's article was too big with the attached ELA, so I'm
forwarding it with that part stripped.
--
jimo@xxxxxxxxxx
maintainer of the omega list
omega-list-request@xxxxxxxxxx
-------------------------------------------------
From: Gary Fritz <fritz@xxxxxxxx>
Hi O-listers,
I'm glad to see that the list seems to be getting back to a few
trading discussions. In the hopes of sparking a bit more trading
discussion and less bashing, I'm appending some code I've been
playing with using Dale Legan's recently-posted Confluence indicator.
Thanks for sharing this with us, Dale, and I hope you come through
your surgery OK.
I've done several things:
* I moved the core Confluence computations into a Confluence
function. Since the Confluence indicator returned several "states"
(bull, bear, yellow, and zero), I modified the return value a bit:
-9 to -1 = Bearish
-0.9 to 0.9 = "yellow" (and zero)
1 to 9 = Bullish
The "yellow" range corresponds to the "yellow" values plotted by
Dale's indicator, but they're divided by 10. So -0.4 is equivalent
to "yellow -4" in Dale's indicator.
* I got rid of a bit of extra computation in the function. I didn't
try to do a hard-core Pierre-style optimization :-), but I noticed
several significant chunks of calculation were being done several
times each bar, so I commented them out and replaced them with an
intermediate variable. It still calls sine/cosine a dozen times on
each bar, which accounts for the bulk of the processing time, but I
think it's a bit easier to understand what the code is doing this
way. (It also seems to work better -- see below.) For the most part
I didn't try to use mnemonic names for these intermediate variables,
because I don't understand exactly what the values represent!!
* I'm appending a simplified Confluence indicator using the function.
* I've also appended a simple Confluence system. This system sets an
entry stop above/below the current bar if Confluence goes into
bull/bear mode, and similarly sets an exit stop below/above the bar
where it exits bull/bear mode. There's also an optional "aggressive"
stop mode that tightens the stops if the market moves in your
direction; for example, if the high is 1000 and your "Trigger" offset
is 2, the initial stop is set at 1002. If the next bar has a high of
997, the stop is tightened to 997+2=999.
The system has its MaxBarsBack property set to 150, which works for
values of Harmonic up to about 15. If you experiment with large
values of Harmonic, you will have to change MaxBarsBack to roughly
10*Harmonic.
Interestingly, when I first wrote this system, I ran into a strange
MaxBarsBack problem. The Confluence indicator worked just fine with
a MaxBarsBack setting of "Auto-Detect." But systems don't have a
setting like that -- you have to specify a fixed value. But NO fixed
value (up to the maximum of 999) worked for either the system OR the
indicator! And I couldn't see anywhere that it was looking back that
many bars. Then, when I did the optimization on the Confluence code,
the MaxBarsBack problem mysteriously disappeared. Sometimes
TradeStation is just spooky... Any ideas what happened?
I've appended a sample system report for the system on SPX, using the
default parameters. The system actually does pretty well, but be
aware that these results are more curve-fit than I like to see. It
probably won't make anyone rich, but I thought some folks might enjoy
playing with it. There are some other things you could do with it --
e.g. it might be interesting to change it to look for long
opportunities when Confluence hits -9, and short when it hits 9. If
I get a chance to throw that together, I'll post it to the list.
The ELA code is appended (assuming it makes it through the list's
size filters). The source and the ELA are also available in my FTP
directory, ftp://ftp.frii.com/pub/fritz . (Remember to hold down
SHIFT when you click on the files, or click the right mouse button,
or do whatever your browser needs to save the file instead of trying
to display it.)
Have fun,
Gary
Confluence SPX-30 min 10/20/97 - 11/13/98
Performance Summary: All Trades
Total net profit $ 132320.00 Open position P/L $ 0.00
Gross profit $ 214885.00 Gross loss $ -82565.00
Total # of trades 90 Percent profitable 57%
Number winning trades 51 Number losing trades 39
Largest winning trade $ 17430.00 Largest losing trade $ -6737.50
Average winning trade $ 4213.43 Average losing trade $ -2117.05
Ratio avg win/avg loss 1.99 Avg trade(win & loss) $ 1470.22
Max consec. winners 7 Max consec. losers 4
Avg # bars in winners 35 Avg # bars in losers 16
Max intraday drawdown $ -7875.00
Profit factor 2.60 Max # contracts held 1
Account size required $ 7875.00 Return on account 1680%
Performance Summary: Long Trades
Total net profit $ 75370.00 Open position P/L $ 0.00
Gross profit $ 110922.50 Gross loss $ -35552.50
Total # of trades 46 Percent profitable 61%
Number winning trades 28 Number losing trades 18
Largest winning trade $ 17430.00 Largest losing trade $ -6737.50
Average winning trade $ 3961.52 Average losing trade $ -1975.14
Ratio avg win/avg loss 2.01 Avg trade(win & loss) $ 1638.48
Max consec. winners 5 Max consec. losers 4
Avg # bars in winners 42 Avg # bars in losers 20
Max intraday drawdown $ -9722.50
Profit factor 3.12 Max # contracts held 1
Account size required $ 9722.50 Return on account 775%
Performance Summary: Short Trades
Total net profit $ 56950.00 Open position P/L $ 0.00
Gross profit $ 103962.50 Gross loss $ -47012.50
Total # of trades 44 Percent profitable 52%
Number winning trades 23 Number losing trades 21
Largest winning trade $ 12760.00 Largest losing trade $ -4400.00
Average winning trade $ 4520.11 Average losing trade $ -2238.69
Ratio avg win/avg loss 2.02 Avg trade(win & loss) $ 1294.32
Max consec. winners 5 Max consec. losers 5
Avg # bars in winners 26 Avg # bars in losers 13
Max intraday drawdown $ -13915.00
Profit factor 2.21 Max # contracts held 1
Account size required $ 13915.00 Return on account 409%
|