Australian (ASX) Stock Market Forum

MovingAverage

Just a retail hack
Joined
23 January 2010
Posts
1,315
Reactions
2,565
Greetings All,

Over the past eighteen months I've been kicking around a few ideas for a monthly based systematic trading system. About three months ago I got serious about developing and testing the system and I'm reasonably happy with the system's performance and I'm now at the stage of contemplating going live with the system. However, before committing my actual capital to the system I'm going to paper trade the system for the next 6 to 9 months and intend to document my experience with the system and the trades here. My intention is to start the paper trades early Jan.

A little bit about the system and my requirements of the system:

Why a monthly system: Well I'm a little time poor and I already trade seperate daily and weekly systems so I figure a monthly based system in which entries and exits are placed at the beginning of each month will not be as demanding on my time.

Entry and Exits: I am but a simple man and so I like simple trading systems. After reading Nick Radge's Unholy Grails I've always been intrigued by the 20% Flipper strategy although I've never had any direct trading experience with the 20% Flipper other than to read the description in Nick's book. The broad logic underpinning the entries in my monthly system were inspired by the 20% Flipper but it is fare to say that my entry signals are radically different to that described in Nick's book. The main difference being that my system is most definitely not based on the "low point" used in the 20% Flipper. Again, I'm a simple man so my exits are based on a simple trailing stop.

System Performance: I've developed and evaluated my monthly system using Amibroker and TradeSim. While I generally consider a range of metrics when evaluating a system's performance the main key headline metrics I look at include: CAR, System Drawdown, % Winners, Profit Factor and Avg Bars Held. I've done some initial monte carlo analysis (using Trade Sim--I don't like Amibrokers' Monte Carlo analysis) and here is what it looks like:

CAR:- Min 35% Max 43%
System Draw Drawdown:- Min 10% Max 17%
% Winners:- Min 52% Max 58%
Profit Factor: - Min 3 Max 5
Avg Bars Held: - Min 34 Max 37

My plan is to go live with this system using an initial bankroll of $50k and a max number of open positions of 20 with each open position being 5% of the portfolio value. As such the above system performance figures were based on the simple model of 20 positions each being 5% of the portfolio value. I only intent to trade XAO so the above is based on stocks making up the XAO.

I will more than likely use Bell Direct to trade this system (yes I know there are cheaper brokers around, but I like Bell for several reasons) so the above performance is based on their current schedule of trade fees ($15 upto $10k, $25 between $10k and $25k and 0.1% over $25k).

Like I said I plan to paper trade for six to nine months before going live so stay tuned while I take my initial positions early Jan. Buy/Sell orders will be placed at the start of each month. I plan to do a bit more detailed Monte Carlo analysis of my system over Christmas so my system parameters may undergo a little tweaking here and there between now and the New Year.

I'm happy to receive any constructive feedback during this journey.

Have a great Christmas and New Year everyone and I hope 2020 brings us all a successful year of trading. Cheers all, MA.
 
Keen to see how you go.

I paper traded weekly flipper system on the US market for 6 months before deciding it wasn't for me. (I posted my results in the forums if you are interested)

Your results are quite impressive and I think it is very good idea to paper trade to give you that extra confidence that there is no issues with your system.

Can I ask about settings for your back testing?
What period did you test over?
What data did you use?
I know your system is monthly but is this done using amibroker monthly backtest setting or is is through the code? (The reason I ask is that it then helps make sense of bars held i.e. 34 months vs 34 days)

Also do you think you could post your equity graph?

Do you use a market filter?
 
Keen to see how you go.

I paper traded weekly flipper system on the US market for 6 months before deciding it wasn't for me. (I posted my results in the forums if you are interested)

Your results are quite impressive and I think it is very good idea to paper trade to give you that extra confidence that there is no issues with your system.

Can I ask about settings for your back testing?
What period did you test over?
What data did you use?
I know your system is monthly but is this done using amibroker monthly backtest setting or is is through the code? (The reason I ask is that it then helps make sense of bars held i.e. 34 months vs 34 days)

Also do you think you could post your equity graph?

Do you use a market filter?

@jjbinks In relation to my backtesting--I used Amibroker's Explorer to give me a dump of all possible trades. I didn't just use entered trades via the backtester which would have only been a sub-set of all possible trades. I then dumped all possible trades into TradeSim for the Monte Carlo simulations which gave me the results that I published in this thread. For the results I posted here I used all stocks that made up XAO from 1 Jan 2000 through to 1 Nov 2019 and my data included all current and delisted stocks (to address survivorship bias). I've done some walk forward analysis recently and for that I used a broader time frame of XAO stocks starting at 1 Jan 1990 through to 1 Nov 2019. I set the time frame in AFL to monthly. Funny you should mentioned hold time as I do have a few uncertainties that I'm looking at in more detail as my feeling is that the hold time should be less but I'm just confirming this so will let you know soon. No problems on posting the equity curve. I'll post up some graphs from you in the next day or so. Yes, I use several market filters but nothing too fancy--volume, price and an index filter (is XAO up, down or sideways).
 
@jjbinks here you go, a few Amibroker graphs for you. Keep in mind these graphs were generated using $50k initial capital with max of 20 open position each being 5% of portfolio value (open positions + cash). I used the trade commission schedule as outlined in my original post. I've used all XAO stocks (listed and delisted) from 1 Jan 1990 through to 1 Dec 2019. First equity graph is the Amibroker equity from its Monte analysis of a 1000 runs. The second graph is the equity curve from a single backtest of Amibroker and the final graph is the drawdown associated with the single run equity curve shown on the second graph. Happy to share any other data you might be interested in.Monthly Monte.png Monthly Single Run.png Monthly Drawdown.png
 
I'm looking forward to this. I was re-reading parts of Nick's book and liked the section in the back about the person trading a monthly system. Like the analysis of this too.

Can't wait to see how it performs!
 
@jjbinks was looking at some of my simulations and the average hold time appears to be weeks. I mentioned in my original post that it was bars (in a monthly time frame) so that was not right so average hold time is 34 to 37 weeks. Just correcting an error in my last post with the equity graphs, the graphs were generated using data from 1 Jan 2000 (not 1990) through to 1 Dec 2019.
 
Your system is 'returning' just shy of 40% average over 19 years. When I see exceptional test results like this in my own systems I always get suspicious. Would be interested to see some OOS and walkforward test results.
upload_2019-12-30_2-34-19.png
 
I'm very suspicious myself and you'll see your annual rate % calculation is in line with the monte results I highlighted in my initial post. I've done a reasonable amount of backtesting, MC and WF testing and have done my best to ensure I'm not curve fitting. I'm going to test it on EU and US market data as well but haven't done this yet. I'll post up some XAO WF results for you so stay tuned.
 
@Joe90 I've just run a quick Amibroker walk forward for you. See below. This is just from a single run to give you an idea. I've actually done more comprehensive WF testing than this in which I'm adding a random element to the entry and then ran 2500 separate WF tests so I can better understand the limits associated with the WF tests--a Monte on my WF testing if you like. Key thing for you to note about the below WF test is I have used the IS and OS over two year periods to ensure I have a statistically relevant number of trades. In this case I was looking for a minimum of 50 trades during each IS and OS periods which two years gave me. For context, the results I provided in my original post where based on around 640 trades. My system has several input variables but for the purpose of this WF test here
I haven't tried to "tune" all variables instead this WF test only seeks to tune a single variable associated with the entry signal.
WFTest.JPG
 
Last edited:
Hi @MovingAverage,

Thanks for posting the details.

My main concern is that those results look "too good."
I guess regardless of how good they look a big part of building a system is trying your best to find a fault in it.

From what you have described it seems that you are fairly thorough with your analysis. The other important thing to think about is whether you have any look-ahead bias in your code.

When I was working on the flipper I realised that there are at least 3 different ways people approach coding this.
1) 20% rise from a n-day low
2) Use loop to make the opposite of a trailing stop (i.e. trailing buy if price 20% > lowest point since last sell)
3) Zig zag function

The zig zag function is forward looking.
If you are using loops you also have to be careful.

Other places where look ahead bias can creep into your code are:
1)Way you set delays for buy/sell signals. (if your results are much worse on a weekly/daily timeframe then this might be an issue)
2)Position scores
3)Market filters
4)Stop losses

Apologies if you already looked into these. I have made these mistakes... unfortunately too many times lol.

Cheers
JJ
 
Hi @MovingAverage,

Thanks for posting the details.

My main concern is that those results look "too good."
I guess regardless of how good they look a big part of building a system is trying your best to find a fault in it.

From what you have described it seems that you are fairly thorough with your analysis. The other important thing to think about is whether you have any look-ahead bias in your code.

When I was working on the flipper I realised that there are at least 3 different ways people approach coding this.
1) 20% rise from a n-day low
2) Use loop to make the opposite of a trailing stop (i.e. trailing buy if price 20% > lowest point since last sell)
3) Zig zag function

The zig zag function is forward looking.
If you are using loops you also have to be careful.

Other places where look ahead bias can creep into your code are:
1)Way you set delays for buy/sell signals. (if your results are much worse on a weekly/daily timeframe then this might be an issue)
2)Position scores
3)Market filters
4)Stop losses

Apologies if you already looked into these. I have made these mistakes... unfortunately too many times lol.

Cheers
JJ

Hi JJ,
Thanks for your input--I appreciate it. I've been developing and trading systems with Amibroker for many years so I too am first to admit that the results on my monthly system look way too good. Part of the motivation for posting here was in the hope people would try and poke holes in my system. I have been trying to fault it for the past few months and while I've found a few issues these haven't had a major impact on the system performance. The results are actually the reason I'm going to paper trade this system in the first instance to see how it tracks against my simulations. I should point out that my system was inspired by some of the concepts of the 20% Flipper but it is actually very different and your points 1 - 3 aren't really relevant to my monthly system. You raise a good issue regarding look ahead bias and I intend to asked a friend to review my Amibroker code to make sure I'm not falling into traps like look ahead bias. Thanks again for your input.
MA.
 
Looks like profits are pyramided.
Deep pockets to pay that tax :)

A way around that is to turn it off (a bit more realistic) or maybe include it into a % commission.
No pyramiding of profits. I don't live trade like that so my simulations don't do it. As I mentioned in my original post, each position is 5% of portfolio value (open positions + cash) with a max of 20 simultaneous open positions. My sims also do not allow position size shrinking in the event cash is less than 5% position size.
 
If you use it, check Positionscore includes a delay.
We had a bit of fun a year ago trying to find forward looking code etc, in a miraculous system
It can be well hidden and tricky
Taxes are important as well
A basic flipper was going from 100k to 10 million from 2006 to now.
if you pay your tax at 33% rate..which is very low and you would need a good accountant for that in Australia ,it ended up at 3millions and would be actually worse as it would hit very hard during draw down periods
So yes, make sure it is not too good to be true
Trouble with monthly systems is it will take ages to detect any error, or realise market has changed..my 2c
 
If you use it, check Positionscore includes a delay.
That's a great point and something I'll look into a bit more. For single run sims in Ami I definitely don't use it because my system doesn't involve entering a position based on a ranking. For my serious monte tests I'm using TradeSim to process an Ami Explorer dump so I'm certainly not using PositionScore there. However, I have been using PositionScore set to random() for my preliminary Monte analysis in Ami (which I do pre-TradeSim analysis) run over 2500 individual sims to give me different portfolio entries. The system performance figures I posted in my original post were via TradeSim so comfortable that PositionScore isn't impacting that. However, you have caused me to think about this a bit more so I'll double check my code and approach. Thanks for your thoughts.
 
We had a bit of fun a year ago trying to find forward looking code etc, in a miraculous system
It can be well hidden and tricky
Taxes are important as well
A basic flipper was going from 100k to 10 million from 2006 to now.
if you pay your tax at 33% rate..which is very low and you would need a good accountant for that in Australia ,it ended up at 3millions and would be actually worse as it would hit very hard during draw down periods
So yes, make sure it is not too good to be true
Trouble with monthly systems is it will take ages to detect any error, or realise market has changed..my 2c

Thanks @qldfrog. You raise a good point about tax. I have a friend who factors this into his system analysis, but to be honest it's not something I take into account. What little spare time I have is generally spent refining and improving the systems I'm already trading. You hit the nail on the head with your comment about monthly systems and it is one of my biggest concerns about trading monthly. Most of my focus to date has been spent studying this system over the longer term 15 - 20 years. But I would like to see if a can get a meaningful understanding of the system for shorter time frames at around 2 years. So far, anything under 2 years gives me less than 50 trades which I feel is not an appropriate sample size. I am toying with the idea of looking at techniques to shorten the hold time with a view to having more trades in a shorter window, but this will probably come at the cost of a reduced CAR. I'd be happy with a reduced CAR if I could get confidence in the sims over a shorter timeframe.
 
Looks like you are very thorough in your approach.

Out of curiosity can I ask if you tried your system on a daily or weekly timeframe?

One thing I still haven't got a handle on is how to determine if a system is performing as you would predict once you start trading (or paper trading). I assume your plan with paper trading for 6 months is to then compare results with a back test over that period to see if things match up. Just wondering what parameters you use to decide whether your real world results match what is predicted by backtest. Personally I look at the monte carlo results from to get an idea of what results I could expect say 90% of the time and then see if my results fit with this.
 
So yes, make sure it is not too good to be true
Trouble with monthly systems is it will take ages to detect any error, or realise market has changed..my 2c

Yes, tax is being incorporated into the positionsize. It's possible to take account of it but I think results are unrealistic anyway. Tax is just a small point :)

For interest:
https://forum.amibroker.com/t/handling-taxes-capital-gains-losses/7748
I'll double check my code and approach.

Not always correct but you can do a quick check here: AFL formula Editor/Menu/Tools/Code Check & Profile

This may indicate references to future quotes in your code.
 
Looks like you are very thorough in your approach.

Out of curiosity can I ask if you tried your system on a daily or weekly timeframe?

One thing I still haven't got a handle on is how to determine if a system is performing as you would predict once you start trading (or paper trading). I assume your plan with paper trading for 6 months is to then compare results with a back test over that period to see if things match up. Just wondering what parameters you use to decide whether your real world results match what is predicted by backtest. Personally I look at the monte carlo results from to get an idea of what results I could expect say 90% of the time and then see if my results fit with this.

I haven't tried this system on daily or weekly timeframes yet. My original desire was for a monthly system as I currently trade daily and weekly systems so that hasn't been a focus for me yet. Correct, I'll paper trade to see how some of the initial trades compare to a few characteristics of my sims. Initially, I will probably only look at individual trade parameters like: trade profit, trade loss, trade draw down, hold time. I won't bother initially looking at some of the broader system parameters like CAR, system drawdown etc as I don't expect to have enough paper trades to draw any statistically relevant conclusions on how it is tracking against overall system performance. I'm not sure where this will get me, but I'm going to look at historical first half calendar year performance over a period of time (that is, run the sims over the Jan -July period for the past 15 years) and then compare my paper trades to this.
 
Top