Australian (ASX) Stock Market Forum

System Robustness

buggalug, the last post was partly in jest, as TT has a proven track record as a forward tested trend following system based on simple mechanical system parameters, and posted on reefcap ... my post was in pair with a previous post, that trend following systems can and do work, however I would look at additional filters to improve the results. Good luck, and look forward to seeing your results.
 
Hi Guys,

I really just did this as an exercise to learn Amibroker, I'm not using a system along these lines.

Stevo:
1. I've added this
2. Buy on next open, sell on next open
3. Good point, as most brokers charge a fixed amount then a percentage I've just picked a value, anyone seriously using this might want to put some sort of conditions in.
4/5/6 Your probably right again, maybe an exercise for the future.
7. 10% by default, these results try a few values.
8. Right again, anyone going to pick a system on this would want to check it with their own data.

So to stress again, this is just a learning experience for me, and some others may find the results interesting.

Here is the lastest code and results:

HighBreakOut = Optimize("HighBreakOut", 20, 10, 40, 10);
ShortEMA = Optimize("ShortEMA", 30, 10, 70, 20);
HighestHigh = Optimize("HighestHigh", 30, 10, 100, 20);
LongEMA = Optimize("LongEMA", 65, 60, 200, 20);
Stop = Optimize("Stop", 10, 5, 20, 5);
DollarLimit = Optimize("DollarLimit", 10, 5, 20, 5);
Liquidity = Optimize("Liquidity", 500000, 500000, 500000, 200000);

SetOption("CommissionMode", 1); //% per trade
SetOption("CommissionAmount", 0.15);
SetOption("MaxOpenPositions", 10 );
SetOption("InitialEquity", 100000 );
SetTradeDelays( 1, 1, 1, 1 ); /* delay entry/exit by one bar */
PositionSize = -10; // always invest only 10% of the current Equity

BangForBuck = ((10000/C)* (MA(ATR(1),200))/100);
PositionScore = BangForBuck;

cond1=Cross(H,Ref(HHV(H,HighBreakOut),-1)); // when todays high crosses last highest high over the last 10 periods
cond2=H > EMA(C,ShortEMA); // todays high is greater than the 40 day Exp MA of closes
cond3=HHVBars(H,HighestHigh) == 0; // todays high is the highest for 70 periods
cond4=EMA(V*C,21) > Liquidity; // ensure at least $500k of money flow
cond5=C < DollarLimit; // only trading in stocks less than $10
cond6=C > O; // todays close higher than open

// the following line is the trigger if all conditions satisfied
Buy=cond1 AND cond2 AND cond3 AND cond4 AND cond5 AND cond6;

// here we define variables used once in the trade
ApplyStop( stopTypeLoss, stopModePercent, amount=Stop );
Sell= Cross(Ref(EMA(L,LongEMA),-1),C); // close crosses below yesterdays average of the low


ttrader3.zip
 
Bugs

Thanks got your mail.

A question for all involved.
Bugs has now come up with some figures re optimisation of T/T.

I guess its time to trawl the figures and come up with the optimised variables which suit what I want from the system.Drawdown,string of losses,return etc.

Then run whatever systems testing is deamed necessary on those values.

I'll do that and get back with tradesim results.

Any other hints (as I,ve never worked with optimisation!).
before I get into it.

Bugs what would be handy is the English for some of the result terminology used for amibroker so I know what it is I'm comparing.

Thanks for your effort.
 
Bugs

Thanks got your mail.

A question for all involved.
Bugs has now come up with some figures re optimisation of T/T.

I guess its time to trawl the figures and come up with the optimised variables which suit what I want from the system.Drawdown,string of losses,return etc.

Then run whatever systems testing is deamed necessary on those values.

I'll do that and get back with tradesim results.

Any other hints (as I,ve never worked with optimisation!).
before I get into it.

Bugs what would be handy is the English for some of the result terminology used for amibroker so I know what it is I'm comparing.

Thanks for your effort.

Tech/a,

My interpretation of the results seems like the parameters produce similar results, around 40-45% winners with 25-30% drawdown. Fiddling the numbers just means it locks in some stocks that happened to sore.

I've been looking for explainations of the columns myself with no luck, maybe someone else can help?

Out of curiousity I locked the short EMA to 30 and the long exit EMA to 120, with only two optimizations I get the below. So I'd be curious what you get with 30 short EMA, 120 long EMA, 40 Highest High and 30 HighBreakout just to see if my results are valid.
 

Attachments

  • 3d.jpg
    3d.jpg
    58.7 KB · Views: 137
Bugs.

Start date and end date.
Position size.
Stop I presume as I have it?
What other parameters?
 
Bugs.

Start date and end date.
Position size.
Stop I presume as I have it?
What other parameters?

Tech:

Start Date : 2/1/1997
End Date : Today
Starting Equity: $100000
Max Open Positions : 10
Buy Next Open
Sell Next Open
Stop Loss : 10%
Brokerage: 0.15% (???)
Current ASX 300 (???)

EntryTrigger:= Cross(H,Ref(HHV(H,30),-1)) AND H > Mov(C,30,E) AND HHVBars(H,40)=0 AND Fml("Liquidity") > 500000 AND C < 10.00 AND C > O;

ExitTrigger:=Cross(Ref(Mov(L,120,E),-1),C);

I haven't done this yet, I have a fixed 10%, so I'll guess i'll have to add it:
InitialStop:=If(Ref(C,-1)>0.90*EntryPrice,0.90*EntryPrice,Ref(C,-1));
Is that saying 10% or the previous close, whichever is more? So if it gains 20% that is the stop loss?

Do you have anything on which stock to choose if you have multiple signals?

Let me know if I missed anything.

Bugs
 
Tech:

Start Date : 2/1/1997
End Date : Today
Starting Equity: $100000
Max Open Positions : 10
Buy Next Open
Sell Next Open
Stop Loss : 10%
Brokerage: 0.15% (???)
Current ASX 300 (???)

EntryTrigger:= Cross(H,Ref(HHV(H,30),-1)) AND H > Mov(C,30,E) AND HHVBars(H,40)=0 AND Fml("Liquidity") > 500000 AND C < 10.00 AND C > O;

ExitTrigger:=Cross(Ref(Mov(L,120,E),-1),C);

I haven't done this yet, I have a fixed 10%, so I'll guess i'll have to add it:
InitialStop:=If(Ref(C,-1)>0.90*EntryPrice,0.90*EntryPrice,Ref(C,-1));
Is that saying 10% or the previous close, whichever is more? So if it gains 20% that is the stop loss?

Do you have anything on which stock to choose if you have multiple signals?

Let me know if I missed anything.

Bugs

Sorry that should be:

EntryTrigger:= Cross(H,Ref(HHV(H,20),-1)) AND H > Mov(C,30,E) AND HHVBars(H,80)=0 AND Fml("Liquidity") > 500000 AND C < 10.00 AND C > O;
 
Something to aim at perhaps.

Looks like im getting there ;)


Monte Carlo Report

Trade Database Filename
C:\TradeSimData\Daily07.trb

Simulation Summary
Simulation Date: 2/09/2007
Simulation Time: 1:11:41 PM
Simulation Duration: 464.06 seconds

Trade Parameters
Initial Capital: $30,000.00
Portfolio Limit: 100.00%
Maximum number of open positions: 100
Position Size Model: Fixed Percent Risk
Percentage of capital risked per trade: 1.50%
Position size limit: 100.00%
Portfolio Heat: 100.00%
Pyramid profits: Yes
Transaction cost (Trade Entry): $44.00
Transaction cost (Trade Exit): $44.00
Margin Requirement: 100.00%
Magnify Position Size(& Risk) according to Margin Req: No
Margin Requirement Daily Interest Rate (Long Trades): 0.0000%
Margin Requirement Yearly Interest Rate (Long Trades): 0.0000%
Margin Requirement Daily Interest Rate (Short Trades): 0.0000%
Margin Requirement Yearly Interest Rate (Short Trades): 0.0000%

Trade Preferences
Trading Instrument: Stocks
Break Even Trades: Process separately
Trade Position Type: Process all trades
Entry Order Type: Default Order
Exit Order Type: Default Order
Minimum Trade Size: $500.00
Accept Partial Trades: No
Volume Filter: Reject Trades if Position Size is greater than
10.00% of the maximum traded volume
Pyramid Trades: Yes
Favour Trade Pyramid: No
Start Pyramid at any level up to level: N/A
Maximum Pyramid Level Limited to: N/A
Maximum Pyramid Count Limited to: N/A

Simulation Stats
Number of trade simulations: 10000
Trades processed per simulation: 7172
Maximum Number of Trades Executed: 351
Average Number of Trades Executed: 301
Minimum Number of Trades Executed: 258
Standard Deviation: 9.37

Profit Stats
Maximum Profit: $5,813,301.56 (19377.67%)
Average Profit: $2,018,626.98 (6728.76%)
Minimum Profit: $552,351.05 (1841.17%)
Standard Deviation: $438,117.73 (1460.39%)
Probability of Profit: 100.00%
Probability of Loss: 0.00%

Percent Winning Trade Stats
Maximum percentage of winning trades: 54.36%
Average percentage of winning trades: 47.84%
Minimum percentage of winning trades: 40.84%
Standard Deviation: 1.72%

Percent Losing Trade Stats
Maximum percentage of losing trades: 59.16%
Average percentage of losing Trades: 52.16%
Minimum percentage of losing trades: 45.64%
Standard Deviation: 1.72%

Average Relative Dollar Drawdown Stats
Maximum of the Average Relative Dollar Drawdown: $18,582.40
Average of the Average Relative Dollar Drawdown: $6,354.48
Minimum of the Average Relative Dollar Drawdown: $1,427.79
Standard Deviation: $1,528.06

Average Relative Percent Drawdown Stats
Maximum of the Average Relative Percent Drawdown: 1.8207%
Average of the Average Relative Percent Drawdown: 1.0783%
Minimum of the Average Relative Percent Drawdown: 0.7348%
Standard Deviation: 0.1249%

Maximum Peak-to-Valley Dollar Drawdown Stats
Maximum Absolute Dollar Drawdown: $626,104.23
Average Absolute Dollar Drawdown: $154,098.20
Minimum Absolute Dollar Drawdown: $26,341.77
Standard Deviation: $38,179.05

Maximum Peak-to-Valley Percent Drawdown Stats
Maximum Absolute Percent Drawdown: 26.2756%
Average Absolute Percent Drawdown: 13.6261%
Minimum Absolute Percent Drawdown: 6.4724%
Standard Deviation: 3.0385%
 
Hi Gorilla --

Yup. Every profitable trade reduces the likelihood that the next trade will be profitable.

Howard

I am very intrigued by the concept that trading systems will over time lose their edge and ultimately start to fail. I have been playing around with a volatility breakout system and have done a great deal of testing with it using ASX data, and it has shown reasonable promise. This system is very very short term, most trades (99%) lasting <5 days and therefore the overall exposure to the market is very small.

Recently, I purchased some historical data from FTSE, just to see how the system would perform on an entirely fresh batch of data.

Enclosed below is the equity curve arising from running the system. Please note the following:

1. I don’t have the actual codes of the stocks belonging to the FTSE 100, so just arbitrarily set up a very simple filter that calculated MA(V*C,100) for every stock on the FTSE and selected the top 100, just nice and quick.

2. No optimisation has been done on the FTSE data. All the parameter values have been set using ASX data.

3. The system appeared to run very well, starting from ~end of 86 (start of my test data started) all the way through to the middle of 99 (some 13 years), before it literally fell off a cliff and has been in a down trend ever since.


My questions are as follows:

1) Has this system hit its used-by date ?
2) How can something that has worked so well up to a period of time suddenly stop working altogether.
3) Given the short duration of the trades involved, one would not think that the professionals would have had the opportunity to study these volatility breakout strategies to any great degree and therefore come up with any counter-strategies to fade them ???
4) To date, I have not seen any such marked deterioriation in the Australian market. Is this because the ASX market is too small a market for the professionals to implement their fading strategies, as there are there are much bigger fish to fry elsewhere ??
 

Attachments

  • equitycurve.jpg
    equitycurve.jpg
    94.9 KB · Views: 84
Interesting observation and analysis bingk6, id be keen to hear others' responses to your questions (those that are most expert than me!).

Sorry that should be:

EntryTrigger:= Cross(H,Ref(HHV(H,20),-1)) AND H > Mov(C,30,E) AND HHVBars(H,80)=0 AND Fml("Liquidity") > 500000 AND C < 10.00 AND C > O;

What does this mean?
HHVBars(H,80)=0

And also, looking forward, as a common sense assumption, do you think that it would be a good idea NOT to apply a price filter (C<10.00) because in the future its likely that most listed companies would have a higher price on average than today.

It would be interesting to see what the average share price was 10years ago as opposed to today.
 
Todays high is the highest high over the last 80 periods.

Price filter.(Larger caps).

Is a stock below $10 more likely to double or treble than a stock over $10?
The price filter is based upon the ASX300 (Roughly) so the small caps are basically not included.

You can of course make your universe whatever you want.
if it tests OK then fine.
Personal preference and a filter Radge suggested at the time of designing.
It increased results and hasnt done so bad realtime either.

Nizar.
Dont try to cover EVERY base!!
You wont have enough arms or legs!
 
What does this mean?
HHVBars(H,80)=0

And also, looking forward, as a common sense assumption, do you think that it would be a good idea NOT to apply a price filter (C<10.00) because in the future its likely that most listed companies would have a higher price on average than today.

It would be interesting to see what the average share price was 10years ago as opposed to today.

Nizar,

tech/a has explained his system a number of times on here and on thecharist, looking at those will explain what he trying to achieve.

The $10 limit probably isn't valid going forward, the same probably applies to the liquidity filter (I did a quick scan of the all ords I currently get 331 stocks that average more than $500k, the same scan in 1997 (of course the all ords would of been different back then) only gets 42.
 
the same probably applies to the liquidity filter (I did a quick scan of the all ords I currently get 331 stocks that average more than $500k, the same scan in 1997 (of course the all ords would of been different back then) only gets 42.

The issue of liquidity when back-testing does raise the issue as noted by buggalug.

Perhaps one should include a CPI related turnover filter in their back-testing.

When you take into consideration that $500K now equated to approx $387K in Dec 1997.
 
The issue of liquidity when back-testing does raise the issue as noted by buggalug.

Perhaps one should include a CPI related turnover filter in their back-testing.

When you take into consideration that $500K now equated to approx $387K in Dec 1997.

Maybe as a rough hack, you could something like XAO*100? Giving something around $620k now, $240k back in 1997.
 
Greetings --

I am seeing code that restricts the purchase to stocks with a maximum price of $10. And questions such as this one:

"Is a stock below $10 more likely to double or treble than a stock over $10?
The price filter is based upon the ASX300 (Roughly) so the small caps are basically not included."

I'd like to make two points.

One. There is good evidence that lower price stocks gain a higher percentage than higher price stocks given conditions that cause both to rise.

Two. Historical prices cannot be relied upon unless those prices are Not adjusted for splits and dividends. A stock that was $15 in 2004, then split 2:1 in 2006, will appear today to have been $7.50 in 2004. But it was not, and the bias toward lower price stocks does not apply to a purchase made in 2004 in a backtest.

Thanks,
Howard
www.quantitativetradingsystems.com
 
Two. Historical prices cannot be relied upon unless those prices are Not adjusted for splits and dividends. A stock that was $15 in 2004, then split 2:1 in 2006, will appear today to have been $7.50 in 2004. But it was not, and the bias toward lower price stocks does not apply to a purchase made in 2004 in a backtest.

Really good point Howard. It appears to mean that stats generated from testing a system on data flawed in the ways you describe must be dubious. But no-one seems to have ASX data that isn't adjusted for splits or with the dividends adjusted into the share price. I've seen the Blackstar study and agree it would be far nicer to have this kind of data to test with (not to mention a CPI adjusted liquidity filter...this is obviously far easier to do). Without this kind of data, what do you do? This could be yet another reason why the big boys don't play in this part of the market..the Aust market isn't big enough to warrant fixing 22 years of data for testing systems like what the Blackstar guys do in the US.
 
SB

Went B pay in the end.
Youve just reminded me to do step 2 in the set up.

Cheers.
 
Top