PDA

View Full Version : Backtesting futures using VBA



whitekodak
12-19-2019, 10:08 PM
I'm brand new to using Excel VBA. I've been having trouble with finding a platform/service that allows me to have accurate backtesting results. I notice that the results for profit are skewed because the entry and exit prices are both incorrect. I've been importing historical data (Open, High, Low and Close) onto Excel and manually calculating profit for quite some time now. This is incredibly tedious and time consuming. I want a more efficient way to do this.

The backtesting strategies I've developed aren't based on moving averages or crossovers. Just simple patterns that I've come up with. The strategy is pretty simple.


There must be a series of at least three rising 'low' values in consecutive order. (This would be in column D)
The last 'low' of the rising series must be greater than the proceeding low. (The following is a link is a picture to better illustrate what I'm talking about) https://ninjatrader.com/support/forum/filedata/fetch?id=1079661


In regards to price entry and exit. The price entry would be the 'low' of the last of the rising 'low' series and the price exit would be the 'close' value of the day that follows the end of the rising 'low' series. (The link above shows the entry and exits labeled in orange.)

I've coded for the strategy before, but I'm having trouble achieving accurate profit results when it comes to backtesting.

Any advice/help would be greatly appreciated!

SamT
12-20-2019, 12:11 AM
How do you tell the 'close' value of the day from the end of the rising 'low' series. Your NinjaTrader image makes no sense to me.

Paul_Hossler
12-20-2019, 10:08 AM
How do you tell the 'close' value of the day from the end of the rising 'low' series. Your NinjaTrader image makes no sense to me.

I thought it was a diagram of where to moor your boat at the docks


@whitekodak -- Can you attach a sample workbook with some (just a little) data, and the results of manually calculating to help validate the VBA results?