Systems Workshop: "Buttonwood" E-mini daytrading system

Post anything related to mechanical systems and automated trading here.
shwh
Posts: 15
Joined: Fri Jul 24, 2015 8:54 pm
Contact:

Re: Systems Workshop: "Buttonwood" E-mini daytrading system

Post by shwh » Tue Oct 20, 2015 8:01 pm

Hey Earik,

re what is/are the strongest aspect, Landscheidt (http://bourabai.kz/landscheidt/golden.htm) postulates that golden section divisions of 90* are where planets have the greatest influence. I.E. in a 90* segment, a planet when positioned 21.2* (.236 = .618^3), 42.5, 47.5 & 68.8* from either the MC or ASC have the greatest effect. Also to a lesser extent the same from either the DSC or the IC. Since those have no traditional aspect names, I just label them L1, L2, L3, & L4. Realize this is developing into a nightmare of variables but I feel this is worth checking out.

Also, as I recall, the testing of your published Lunar system showed the highest results for a Sun/Moon interval of 111* - which happens to be 90* + 21*. So rather than the cliche approach of buy NW sell Full - with a mean Moon movement of about 13*/day this would suggest taking some kind of action approx 1.6 days prior to and following each of the 4 phases. However, since Landscheidt says positions prior to and after ASC & MC are stronger than those of DSC & IC, you'd be looking at 1.6 days prior to and following NW, & 1st Qtr, with less expectation for prior and following Full or Last Qtr.

thanks again for sharing this project with everyone.

Sean

User avatar
earik
Site Admin
Posts: 474
Joined: Mon Dec 01, 2014 12:41 pm
Contact:

Re: Systems Workshop: "Buttonwood" E-mini daytrading system

Post by earik » Tue Oct 20, 2015 8:53 pm

Hi Sean,

Interesting. If you look back at the chart I posted with the smoothed average trade values, some of those numbers pop up there too. In particular, there's a nice peak right at 110, which is right there with the settings that the Lunar system uses. :D

34 degrees is the other interesting place, which is the absolute low ebb area as far as volatility goes. If you consider 0-180 as a spectrum with hard boundaries at 0 and 180, then 34's mirror image is 180-34 = 146, which is the same as the final secondary high point on the chart. Doesn't seem to match up with Landscheidt's theory, but I always pay attention when the numbers pop out like that. Rather than a full-moon-to-new-moon oscillation, this particular chart suggests that there's a tradable oscillation located from 34 to 146, which happens to be 112 (there's your number again) degrees apart.

Anyway, cool stuff. The way I'm doing it, this measures all aspects, not only those to ASC/MC, but between everything in the system. To test Landscheidt's theory out, you'd have to take the function and comment out calculating any natals except for ASC/MC, and then you'd be able to prove or disprove it, at least from the perspective of spherical astrology, which is probably not what Landscheidt was using when (he/she?) came up with his/her rule.

Regards,

Earik

shwh
Posts: 15
Joined: Fri Jul 24, 2015 8:54 pm
Contact:

Re: Systems Workshop: "Buttonwood" E-mini daytrading system

Post by shwh » Tue Oct 20, 2015 9:19 pm

Earik,

I wasn't suggesting using Natal MC & Asc but rather transiting ASC & MC in relation to Natal Planetary positions or even current planetary positions. Btw 34 is .382 of 90 & 146 = 90 + 56 w 56 being .618 of 90.

regards,

Sean

User avatar
earik
Site Admin
Posts: 474
Joined: Mon Dec 01, 2014 12:41 pm
Contact:

Re: Systems Workshop: "Buttonwood" E-mini daytrading system

Post by earik » Wed Oct 21, 2015 6:58 pm

Buttonwood_v4: organizing the filters and getting to phase 2

We've spent some time testing different market weather filters, and have come up with some promising candidates. It's now time to move the system forward past the first phase. If you remember from the "conceptual overview" post I made towards the beginning of this thread, I mentioned three components:
1) Determine the market's weather. Are we in a day that is trending or pulling back? ("Weather" component)
2) If we are in a trending day, trade. If not, stay clear. ("Entry/Exit" component)
3) Monitor various filters, etc, to help us fine tune and tweak the entries so they occur appropriately. ("Filters" component)
We have now gotten to the point where we have fleshed out a workable solution for the weather component, and also a poentially workable solution for the entry/exit component. That's not to say we're done with them, but we've made some progress. What I've done in version 4 is merged our two weather forecasting algorithms so that the system trades if either the Progressed-to-Natal function triggers, or the Spherical-Conjunctions function triggers. Here's what that looks like in the system report:
v4_system_report.png
System Report for Buttonwood_v4
v4_system_report.png (36.85 KiB) Viewed 30675 times
v4_equity_curve.png
Equity Curve for Buttonwood_v4
v4_equity_curve.png (35.9 KiB) Viewed 30675 times
Let's take a moment and consider what we've come up with this far, in terms of pros and cons:

Pros:
1) Our system has a nice, upward sloping equity curve without too much adverse movement.
2) We've got over 2500 trades. That's a LOT of trades. From a degrees-of-freedom/curve-fitting perspective, the more trades you've got, the better off you are. It's very easy to build a good looking system if there are only 10 trades that go into it, but it's much harder to build one with thousands.
3) Our drawdown-to-profits ratio is very low. If you rephrase the numbers in terms of dollars earned per dollars risked, you find that we're cranking out roughly twice our drawdown amount per year in profits.

Cons:
1) 42% accuracy is a little low. Of course, this is trend following, so this might just be part of how this system operates.
2) Our average trade is too low.

That last point about the average trade is really the issue right now. Although we aren't really going to suffer one tick of slippage every single trade, as we'll be using limit orders to enter (why would we voluntarily agree to pay the spread?), when building a system, we must assume that we'll be using market orders. Paying a tick on the way in, and a tick on the way out costs $25 per trade, multiplied by 2662 trades, results in a slippage cost of $66,550. This is why daytrading systems are so hard to build - all the profits go to pay slippage and commissions. If we were building a daily system, we'd have an average trade value of around $200-$300 or so, and a tick here or there really wouldn't matter at all. But in this case, a tick here or there is huge - it's enough to wipe out the edge we currently have. This is why I've been focusing on the average trade value so much in the past few posts, and why it's such a critical thing to keep in mind when building intraday systems.

So right now we've got a theoretical edge, but in practical terms are only breaking even. Not losing money over the long haul, but not really making it either. Framing that in a positive way, it means we're ahead of roughly 90% of market participants, which gives you something to think about. :shock:

Our goal then is to figure out how to bump that average trade value up. Every additional dollar we make at this point goes to our profit pile, as we have already got to the point of paying the bills. So we need to figure out how to place better trades, or find a way to avoid placing losing ones as frequently as we currently are. Now that we're past phase 1 (market weather), we can look to all aspects of our system for improvements. Here's a quick list to start:

1) Build another market weather function, and do a two-out-of-three filter system, rather than an either-or like we have now.
2) Tighten up our threshold levels to restrict trading to only the most volatile days.
3) Look for better signals than our 8/34 averages are giving us.
4) Look for day/time/pattern/etc filters, along the lines of the big list that orionsbelt posted earlier.


As promised, I've added a function to allow us to explore point 4 in that list. In the script, you'll see it written like this:

Code: Select all

#other filters -----------------------------------------------
                                 
other_filters = Buttonwood_AdditionalFilters(); 
If you want to mess around with ideas, you just open up the Buttonwood_AdditionalFilters function, and can experiment with writing filters. Return a "true" value if it's OK to trade, and a "false" value if it's not. You don't have to change anything in the main script to test your ideas, and there's no way to break this, as you can just wipe out your work and start over, so don't be afraid of that function - it's quite resistant to scripting errors. :) Right now I'm not doing anything there, and just have the function set to return "true" no matter what. If you're a beginner with QScript, this is the place to look for improvements, as the scripting will be the easiest. For example, you can do something like:

Code: Select all

if (time < 1400) return true;
else return false;
Assuming your computer is in Eastern Time, that's going to chop off all trading after 2pm, which is starting to get too close to the close of the day to be profitable. That one change is going to bump the average trade up to almost $30, so you can see how a few of these can be used to start helping the system claw its way into the profitable-in-real-life category. As a quick aside, the way to write the above code so it works for everyone in any time zone would be like this:

Code: Select all

if (time < (1400 - timezone*100))
    return true;
else return false; 
So in this case I'm subtracting the user's time zone (multiplied by 100, since that keyword only returns a single number) from 1400, which will give the correct number no matter what time zone the user is running their charts in. Just a subtlety which you don't have to worry about if you don't want to, since it's easy to fix later on if you find something good.

Anyway, I'm trying to give everyone access to improving this system, according to their own scripting skills. So beginners, check out the Buttonwood_AdditionalFilters. If you're a beginner and feel like stepping up your game, you can look at Buttonwood_Signals as well, which is the same sort of thing, but slightly more involved. In that case, return a -1 to go short, and a +1 to go long. I think there are some big gains to be made in both of those functions. Finally, if you're very comfortable at scripting, or just want to mess with your head ;) , go fool around with the weather functions, which are the most complicated.

All for now. We've actually come to an important milestone with where this is at, so now it's time to start tweaking and finessing and see if we can get this trade-able.

Regards,

Earik
Attachments
buttonwood_v4.zip
(5.34 KiB) Downloaded 516 times

Simon.B
Posts: 91
Joined: Thu Jul 23, 2015 8:26 pm
Contact:

Re: Systems Workshop: "Buttonwood" E-mini daytrading system

Post by Simon.B » Thu Oct 22, 2015 12:19 am

Hi Earik,

Wanted to ask you about stops and targets. I know you are against using those in daily systems, do you feel the same way
on such short time frame also ?

Just to make sure I understand the process clearly, right now system is in the Market all the time, and trades when "weather" is favorable and MA's trigger, what about exit ? Maybe I missed explanation for it, but does it wait for correct "weather" to exit also ?

Thanks,
SImon

sbank
Posts: 174
Joined: Tue Jul 21, 2015 9:35 pm
Contact:

Re: Systems Workshop: "Buttonwood" E-mini daytrading system

Post by sbank » Thu Oct 22, 2015 1:04 am

Based on v4, I made a minor change to the additional filters, and would like to see what folks think. The idea is to only enter trades when the fractal trend indicator is showing the beginning of a trend.

This the contents of my additionalfilters file:

Code: Select all

if (barnum==barsback) {
    frac_valley=1; 
    frac_peak=5;
}  

frac=FractalTrend((h+l)/2,8);

if ((frac > frac[1]) and (frac[1] < frac[2]) and (frac < frac_valley)) {   
    return true; # enter at "valley"                                       
} else if ((frac < frac[1]) and (frac[1] > frac[2]) and (frac > frac_peak)) {
    return false; # exit at "peak"
} else {
    return false;
}     
Using 5min bars for 2 years of data, I see the win/loss ratio increase, but I think more importantly the max drawdown is smaller, which means we can trade more contracts (all things being equal).

v4:
Image
v4-frac:
Image

Simon.B
Posts: 91
Joined: Thu Jul 23, 2015 8:26 pm
Contact:

Re: Systems Workshop: "Buttonwood" E-mini daytrading system

Post by Simon.B » Thu Oct 22, 2015 1:58 am

Hi sbank,

Thanks, it does seem most stats improved. But like Earik said - we need to get average trade number quite a bit higher than where it is now.
Without reaching at least $80, in my opinion, system will not be profitable, I think that should be priority at this point.

Simon

sbank
Posts: 174
Joined: Tue Jul 21, 2015 9:35 pm
Contact:

Re: Systems Workshop: "Buttonwood" E-mini daytrading system

Post by sbank » Thu Oct 22, 2015 2:05 am

My next thought on improving the signal. Since we are focusing on a trend following style with this discussion, I created another timing signal to go with the MA crossover. This is a basic channel breakout style. I created the following function:

Code: Select all

#length: 5
input:length;

if (barnum==barsback) {
    signal=0;
}

high_channel=average(high,length);
low_channel=average(low,length);

if (close > high_channel) {
    signal = -1;
}
if (close < low_channel) {
    signal = 1;
}

return signal; 
I then modified the original 4v strategy, to AND the two signals together:

Code: Select all

#compute trading signal --------------------------------------

signal1 = Buttonwood_Signal(8,34);
signal2 = Channel_Breakout(5);
signal = signal1 + signal2; 
This helped take the "bumpiness" out of the equity curve.

v4 (untouched):
Image
v4 (untouched stats):
Image

v4 (with channel breakout):
Image
v4 (with channel breakout stats):
Image

supracharger
Posts: 24
Joined: Tue Jul 21, 2015 9:32 pm
Contact:

Re: Systems Workshop: "Buttonwood" E-mini daytrading system

Post by supracharger » Thu Oct 22, 2015 4:32 pm

Sbank,
I thought of some pointers, and possible errors in your fractal snippet of code. First, the time frame your allowing with the code you have is just about 1 bar of a window. To help widen the window :mrgreen: , and to have the ability to use more filters than just the fractalTrend, I would do this with the function:

P.S. I like the channel idea, it helped with the stats.

- Andrew

Code: Select all

inputs: fracLen(16), Thresh(7), useDelta(TRUE);		# Initialized to help with clarity

hlc = (H+L+C) / 3;					# You Need to also incorporate at least the Close, since it is the most recent data
									# i.e. less lag
frac = FractalTrend(hlc, fracLen);

# Since you generally want a bigger window since the volatility carries out longer than the reading
# a Threshold ONLY seems to work the best.
if (useDelta==FALSE){
	if (frac>Thresh)  return TRUE;
	else			 return FALSE;
}

# If the user wants to have the fractalTrend increasing (positive Slope, all you need is Calculus!) while it is 
# above the threshold one can just do this:
if ((frac>thresh) AND ((frac-frac[2])>0) return TRUE; 		# 2 instead of 1 helps with the noisy signals
else 						      return FALSE; 

# if you also want this function to signal when the FractalTrend is saying the trend is dead, as a potential signal
# that volatility will increase, you could add that code hear.
# With a little modification
Last edited by supracharger on Thu Oct 22, 2015 10:11 pm, edited 1 time in total.

User avatar
earik
Site Admin
Posts: 474
Joined: Mon Dec 01, 2014 12:41 pm
Contact:

Re: Systems Workshop: "Buttonwood" E-mini daytrading system

Post by earik » Thu Oct 22, 2015 8:06 pm

Hi All,

Nice, work sbank! Your channel enhancement definitely seems to improve things!

Sometimes it can be difficult to tell whether or not a change really helpful or not. The most obvious way to tell is to just program the change and look at the system report. But sometimes a better way is to program the system report to show only the trades that you are cutting out as a result of the change. In other words, get a system report on what you are losing if the change were implemented, rather than looking at what's left. If we take a look at the fractal trend results that sbank posted, we've got:

Original system:
Profit = $24,325
num trades = 661
avg. trade = $36.80

With Fractal Trend filter:
Profit = $15,100
num trades = 433
avg. trade = $34.87

So what happened is what we chopped off roughly 200 trades from the original. What do those 200 trades look like, sitting all on their own? You can script it and get the exact numbers, or you can work backwards with some of the statistics from the two system reports. Doing some simple subtraction between the two gives us:

Filtered trades:
Profit: $24,325 - $15,100 = $9,225
num trades: 661 - 433 = 228
avg. trade: $9,225 / 228 = $40.46

Once you see it represented that way, things look a little different. The sub-system that we are filtering out with this approach is actually responsible for over $40/trade to the bottom line, which is more than either the original system or the filtered one. Looked at in that light, it definitely casts some doubt on the approach. You never know until you test, so you just have to run through this sort of thing with every single idea you've got, and eventually you'll start hitting on some filters that really make a difference.

In that light, let's take a look at what sbank did with the channel filter, doing the exact same thing:

Original system:
Profit = $69,812
num trades = 2671
avg trade = $26.14

With Channels:
Profit = $86,900
num trades = 2353
avg trade = $36.93

Again, with some subtraction, we can reverse engineer the system report for what got removed:

Filtered trades:
Profit: $68,812 - $86,900 = -$17,088
num trades = 2671 - 2353 = 318
avg trade = -$17,088 / 318 = -$53.73

So in this case, we're filtering out $17k worth of losses, which (on their own) represent a system that loses $53 per trade. That's a good filter, and you can see how much it helped the system, increasing profits, average trade, drawdown, and accuracy. Very nice. :D

Responding to Simon's questions - yes, this system will only trade if the market weather function says we're going to have a big day. If the weather function says to stop, it won't immediately get flat, but will exit at the next contrary signal, or at the end of the day. Practically speaking, I added a input parameter to only compute the astro stuff once per day for increased speed, so each day will either be on or off, rather than half good and half bad, like you'd see otherwise. There are no stops or targets, and I'm sticking with my position on those from MTS. At first it can sound like a strange thing not to use stops or targets in systems, and goes completely in the face of what we're taught as beginner traders, but that's what the numbers say, and I go with the numbers. If stops or targets are a good thing, they'll improve our systems in the same way we saw sbank's channel idea improve on our averages. If they can't do that, they fall into the "this idea will lose you money" category, and there's no place for that sort of thing when it comes to building mechanical systems.

Finally, regarding the $80/average trade comment... that seems a little high to me on a 5min chart. Not that it's impossible to get there, but that's a really, really good system. A good system is around $40/trade, very good is around $60/trade, and awesome is around $80/trade. All of those are tradable though, although you have to be much more careful about how you place your orders if your edge is only $40/trade. Anyway, ours is almost $40 now, so we're starting to get ahead of the game with this project after only a few suggestions from the community. :D

Regards,

Earik

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests