Australian (ASX) Stock Market Forum

System Under Development and Testing

Joined
24 January 2006
Posts
496
Reactions
1
Just for a bit of fun, thought I would play around with a futures system and see how it would perform on the ASX.

The first set of tests were interesting with an initial capital base of $100,000 ended up with something like $0.79c. Back to the drawing board a study of the charts and other systems and came up with what is included below. The short side of the system is not included.

To date the system has been tested over a variety of historical and more recent time frames and universes. Two sets of backtesting results are provided for the period 1/01/2006 to 30/04/2007. One covers the entire ASX and the second covers the ASX300.

The system is currently being forward tested into the live market.

As usual the system is provides as is for testing purposes and the usual caveats apply. Do your own testing and research.

Code:
// Test System 48 HHV & 12 LLV Long & Short
// Define buy conditions and name each one as a variable

PositionSize = -10; // always invest only 10% of the current Equity 

Highest10Periods = Cross(H,Ref(HHV(H,10),-1)); // When todays high crosses last highest high over the last 10 periods
EMAConditionLong = H > EMA(C,40); // Todays high is greater than the 40 day Exp MA of closes
Highest48Periods = HHVBars(H, 48) == 0; // Todays high is the highest for 48 periods
Lowest48Periods = LLVBars(L, 48) == 0; // Today's low is the lowest for 48 periods
VolumeCondition = EMA(V * C, 21) > 500000; // Ensure at least $500k of money flow
ValueCondition = C < 10.00; // Only trading in stocks less than $10
CloseConditionLong = C > O; // Todays close higher than open

// Trigger buy if all conditions satisfied

BuySig = EMAConditionLong AND Highest48Periods AND VolumeCondition AND ValueCondition AND CloseConditionLong AND Highest10Periods;

//Sell Condition Lowest Low for 12 periods

SellSig = LLVBars(L, 12) == 0;

Buy = ExRem(BuySig, SellSig);
Sell = ExRem(SellSig, Buysig);

/* Short Conditions

not included as part of this example

*/

// Define Stop Condition(s)

ApplyStop( stopTypeLoss, stopModePercent, amount = 10 );

// Define what gets displayed on the chart

shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy , colorYellow, colorRed ), 0, IIf( Buy , Low, High));

Filter = Buy OR Sell; 

/*  lists exploration results conforming to our buy/short criteria */

AddColumn(Buy, "Buy", 1.0); //
AddColumn(Sell, "Exit Buy", 1.0); 
AddColumn(Low, "Low", 1.3); //
AddColumn(High, "High", 1.3); //
AddColumn(Close, "Close", 1.3); //

Enjoy.
 

Attachments

  • Backtest report 1-1-2006 to 30-4-2007 All ASX 48HHV.doc
    72 KB · Views: 31
  • Backtest Report 1-1-2006 to 30-4-2007 ASX300 48HHV.doc
    71.5 KB · Views: 24
Hi Les,

Those are nice stats - I'm only getting 20% profit when testing it against the same period (All Ords). Any chance of attaching your backtest settings file? I think it's my buy/sell with 1 day delay (on open) that's causing the difference, because when I set that to 0, it jumps to 120%

Thanks for posting your code, I'm trying to learn as much as I can from any systems (either in the wild or in test).
 
Hi Les,

The numbers are unbelievable. However, IMHO, this system is not tradable. From my testing, the numbers that you quoted are achievable only if you have a buydelay of 0 and buyprice=open. This means that the buy signals are confirmed only at the close of a day and yet you somehow managed to purchase on the open of the same day without having a confirmation.

The best outcome you can get with intraday day is if you were watching the screen for say the last 30 mins trading (which at that stage, your reasonable confident that the buy signal will be triggered) and you participate at the closing auction (ie buyprice=close with buydelay=0). Alternatively, have a buydelay =1 and buyprice = open. You will find that the results from these two, more viable options, are dramatically different to your results.
 
Bing.

And therin lies the point about practical application of analysis.
A common flaw in many methods developed.
 
Bingk6,

Thanks for your comments.

They are unbelievable aren't they. :)

Already aware of the differences in results and a directory full of test reports.

Good to see people are actually trying it out for themselves, which is why it was provided.

Try the following:

1. settradelays(1, 1, 0, 0)
2. settradelays(1, 0, 0, 0)
3. Try adding - "PriceConditionLow = Open > 0.50" - an additional condition not in the provided code.
4. Try changing the limit on the ValueConditionLong condition.
5. Try removing the stoploss or increasing it to 25% or reducing it to 5%

Varying whether the buy/sell price is at Open, Close, High, Low or Average will also change the results.

Pragmatically, I would prefer to think in terms of slippage, as there is no guarantee that you will get filled at a particular level.

Changing the stock universe or the period of testing provides some interesting variations on the results.

Cheers and have fun.
 
From a practical view selling at a high or a low,while this can be simulated cannot in practice be mirrored.

8% of initial buy price (from my systems testing of various methodologies)appears to be the optimum initial stop loss value.
 
Bing.

And therin lies the point about practical application of analysis.
A common flaw in many methods developed.
And therein also lies the point of not taking things at face value and testing them thoroughly.
 
From a practical view selling at a high or a low,while this can be simulated cannot in practice be mirrored.

8% of initial buy price (from my systems testing of various methodologies)appears to be the optimum initial stop loss value.

tech/a,

Totally agree, with your view with respect to using the high/low from a simulated prespective.

The use of the average or allowing for slippage (% value) would possibly be a more appropriate consideration from a simulation perspective.

Simulation is usually based on the premise that you will always be fully filled at the prevailing price, which may not always be the case.

Hence, the need to ensure that the selected universe or selection criteria contains a minimal level of liquidity to increase the probability of full order fills, but cannot necessarily cater for fast moving stocks or markets.

Just some additional thoughts.

Cheers.
 
Hence, the need to ensure that the selected universe or selection criteria contains a minimal level of liquidity to increase the probability of full order fills, but cannot necessarily cater for fast moving stocks or markets.

This is a similar problem as what occurs when you are trading stocks with wide spreads (or i call them criminal spreads). In these cases, The buy/sell prices cannot be accurately simulated by a computer program.

Tradesim has a liquidity filter which allows you set which % of $value turnover required as a criteria for taking a trade.

For example if the percentage is set to 5%. Then you will only take the trade if your position size is less than 5% of the average daily market value turnover of the stock. If your position is $10k then only if the daily volume is over $200k would you take the trade.

And since the low volume stocks are the ones with criminal spreads, this is one way to deal with such a problem.

Quite a useful tool i reckon.
 
Lesm.
I was just reading over the conditions in the code in your original post.
Lowest48Periods = LLVBars(L, 48) == 0; // Today's low is the lowest for 48 periods

What do you mean by this condition?
Do you mean todays low is the highest low for 48 periods??
(that would make more sense to me since higher highs and higher lows, not lower lows, is what defines an uptrend)
 
Lesm.
I was just reading over the conditions in the code in your original post.


What do you mean by this condition?
Do you mean todays low is the highest low for 48 periods??
(that would make more sense to me since higher highs and higher lows, not lower lows, is what defines an uptrend)
nizar,

Your understanding is correct.

The following is used for the longside:

"Highest48Periods = HHVBars(H, 48) == 0; // Todays high is the highest for 48 periods"

The condition you have quoted is part of the short side conditions not the long side and is not used in the example provided. I haven't made the short side code available.

Cheers.
 
nizar,

Your understanding is correct.

The following is used for the longside:

"Highest48Periods = HHVBars(H, 48) == 0; // Todays high is the highest for 48 periods"

The condition you have quoted is part of the short side conditions not the long side and is not used in the example provided. I haven't made the short side code available.

Cheers.

Has anybody done any more with this?

Cheers,
 
Hi Les,

Those are nice stats - I'm only getting 20% profit when testing it against the same period (All Ords). Any chance of attaching your backtest settings file? I think it's my buy/sell with 1 day delay (on open) that's causing the difference, because when I set that to 0, it jumps to 120%

Thanks for posting your code, I'm trying to learn as much as I can from any systems (either in the wild or in test).

Ahoy Woody

With the Alphabetical starting nature of the All Ord's
I can't see how you can get a true reading when working from the Open
Most charts use the previous nights close as the open

For Example when the Overseas Indecies rocket overnight the Open in real time gaps up but the charts show the previous nights close

Salute and Take care
 
A common error in systems testing found by those here is that most set the BUY at the OPEN of the day in which the buy signal is triggered in practice this is not possible.

This obviously makes the system look as if it performs brilliantly.

By setting the buy at the NEXT possible open---which is the day after the trigger (or bar after in the case of a shorter term system) then the buy is taken at the next possible open.

To be clear on this.
If an EOD trader you would see a trigger for a buy tonight.
The earliest possible time you could take a trade is tommorows open.

This is what the above discussion has found and correctly adjusted testing for.
 
A common error in systems testing found by those here is that most set the BUY at the OPEN of the day in which the buy signal is triggered in practice this is not possible.

This obviously makes the system look as if it performs brilliantly.

By setting the buy at the NEXT possible open---which is the day after the trigger (or bar after in the case of a shorter term system) then the buy is taken at the next possible open.

To be clear on this.
If an EOD trader you would see a trigger for a buy tonight.
The earliest possible time you could take a trade is tommorows open.

This is what the above discussion has found and correctly adjusted testing for.


Correct and tend to agree.
A good method for testing system robustness is by delaying your trades.
 
Nizar its not delaying your trade at all!!

Its simply the first available time you can place the trade.
Its not a tactic!
Its correct application.
 
Top