Backtest help!

lote_tree

Active member
Messages
131
Likes
23
Hi

I’m looking to backtest a trading method on some data I have downloaded. The method is a variation of Jake Bernstiens' 30 minute breakout strategy.

The Problem is it seems it’s going take me ages to do this so I thought I would get some help on whether I can get it done quicker.

I’m looking to trade the FTSE 100 Futures market.

My Rules:

•The high and low for the first 60 min of each day will be the parameters for the rest of the day.

•Only buy when price exceeds the high and sell when the price exceeds the low of my parameters for the day by 6 points.
•Only enter a position after 60 minutes
•Stop Loss is the opposite parameter to the one I have entered. If price exceeds the opposite parameter then close current position and reveres position with double the number of contracts.
•Never enter a position in the last 60 minutes of each day.

Example of Buy Signal:

FTSE 100 Futures

Opens 8.00 am

8.00 am – 9.00 am

High = 6700, Low = 6650

10.00 am
Price = 6706 Buy 1 Contract

Example of Sell Signal

8.00 am – 9.00 am

High = 6700, Low = 6650

10.00 am
Price = 6644 Sell 1 Contract

Stop Loss Example

8.00 am – 9.00 am

High = 6700, Low = 6650

10.00 am
Price = 6706 Buy 1 Contract

12.00 pm
Price = 6644 Close current position & reverse position by selling 2 Contracts

I have 5 years worth of intra day data in a cvs file. Is there a way that I could actually do this quicker than going through the data manually?

Thanks

Peace.
 
Sure, just write a formula in Excel. By the way - am I missing something or your strategy lacks an exit signal (except for the stop loss)?
 
It's a day trade dude.. The strategy implements a market on close order. Exit at the close of the day.

Excel formulas aren't going to cut it. I was specifically looking for programming advice.

cheers.

:|
 
Well, it still seems to me, that this is a rather simple system - and easy to test in plain Excel, even without VBA. What kind of specific problems did you encounter?
 
The problem is i've been exposed to programmes like wealth lab that specialise in backtesting all sorts of methods. Both complex and simple. Knowing how to programme could give me an advantage in the long run.

Programming advice at wealth lab is not easy to digest so I would be looking for some advice on where I could find some quality resources that makes learning trading programming much easier to learn.

Cheers

:|
 
Learn VBA or any other simple programming language, you won't have any problems with programming in trading applications. Wealthlab language and the like are very simple, it is really enough to be able to think algorithmically in order to write code in them.
You can test your system in Excel just to practice algorithmic thinking - using Excel help: no offence intended, but writing formulas to do it should not take more than 15-30 minutes.
 
I see what you're saying and I appreciate that. Can you give me an example of what the stop loss would look like in the excel formula?

That seems to be the hardest part to building the formula.

cheers
 
I guess the easiest way to do it and to see it well for better analysis would be to put the stop loss in a separate column. Or even two columns - for a long stop loss and short stop loss.
So let's say you have the column of data, each row has date, time, high, low, open, close. You add two columns with formulas:
=IF(time = 8-9am, low - 6, RC[-1])
=IF(time = 8-9am, high + 6, RC[-1])
One is your short, and the other is the long stop loss for the specific day.
You could do it in a more efficient way, of course, but this is the simplest from the top of my head.
 
Tadragh1

The attached excel document gives an example of what i'm trying to achieve.

It would be great if you could give me some feedback on whether we are on the same wave length here and how best to script the system for this particular strategy.

The data is arranged exactly the way I have downloaded. It will give you examples of the stop losses and the entry and exit parameters.

If you have any questions about the method please let me know..

Thanks..
 

Attachments

  • FTSE 100 4 days Data.xls
    19 KB · Views: 507
Hey lote_tree, I am looking at your spreadsheet. I understand, that you take positions only at the beginning of the candles, even if desired conditions happen during the previous candle? It seems then, that your stop loss is not exactly a stop loss - if the price goes against you in the beginning of a candle, you wait an hour before reversing your position, right?
 
Hey Tadragh1,

Correct on both counts.

No buying or selling decisions will be taken until the beginning of the second candle for the day. Thereafter, buying and selling decisions will only be taken at the beginning of each candle for the day.

Also, no buying or selling decisions will be taken at the beginning of the last candle for the day because the logic is that there isn't enough time for a significant move to take place. I'm not saying it can't happen but generally it's improbable.

As you've probably noticed the system is looking to capture large trending days.

I could have made an absolute fortune with this recently because the FTSE has had some huge trend days. But no doubt, you can also loose a bunch if you're in a choppy day. Choppy days are brutal for this system.

In an ideal world I would like to go through the data manually all the way through because it would would give me more of a fine tuned sense of the viability of the system. I started to feel that as I was testing the data manually, but it's just not practical.

Cheers..
 
OK, here you go. Formulas do not look very attractive (a lot of IF instructions), a possible workaround would be to add more columns, but it is still readable, I think.
Take note of the parametrization of spread, trigger and reversed position size.
 

Attachments

  • FTSE 100 4 days Data_formulas.xls
    38 KB · Views: 370
Tadragh,

Great work dude. Thanks alot for that. I really appreciate the time you've put into this mate.

I'll let you know about the performance.

cheers

lote
 
Tadragh1

The attached excel document gives an example of what i'm trying to achieve.

It would be great if you could give me some feedback on whether we are on the same wave length here and how best to script the system for this particular strategy.

The data is arranged exactly the way I have downloaded. It will give you examples of the stop losses and the entry and exit parameters.

If you have any questions about the method please let me know..

Thanks..
Lote

Further to our PMs I have reformatted your excel file, so that we can load it into Amibroker.

I have attached the file here, because you cannot attach files to PMs.

I will give you further instructions by PM

Charlton
 

Attachments

  • testdata.csv
    1.9 KB · Views: 407
Top