Excel/VBA Backtesting

hyunski

Junior member
15 2
Hi guys,

Was wondering if anyone would be interested in using this Excel/VBA backtesting spreadsheet I've made...I'd like to see if I should clean this up and release it for people to download, learn and test different strategies they have.

Basically it'll pull online data from yahoo finance and create statistics to measure your strategy's effectivenss on stocks. It also has pre-made functions that do things for you like calculate trailing standard deviation, averages, median, etc. Also, it has a screener functionality that basically screens the market for your patterns that you program. This'll be an upgrade to people who like to use FINVIZ, like myself.

But I think the best thing is that you can customize your code and interface any way you want....so you're not limited to what a backtesting software gives you, but you can create anything! Below is an example of a code for a simple moving average golden-cross/dead-cross strategy:

'[ENTRY SIGNALS]
'Filter #1: Uptrend --> 20-SMA above 60-SMA
If i < UBound(c) Then
If ma20(i) > ma60(i) Then
signal_filters(i) = signal_filters(i) + 1
End If
End If


'[EXIT SIGNALS]
'Exit #1: Downtrend --> 20-SMA below 60-SMA
If i <= UBound(c) Then
If ma20(i) < ma60(i) Then
exit_signals(i) = exit_signals(i) + 1
End If
End If

Here is a YouTube video demonstrating the functionalities:
https://www.youtube.com/watch?v=_QSyPCNg4kM&feature=youtu.be&hd=1

And here is what the result looks like:


And here is the interface:


Here is the result of a screener that screens stocks on your strategy:


And here is a large-scale backtester that will check your strategy against all the stocks you selected with a single click of a button:


Would just like to gauge the demand before I dive into this, debug everything and write a manual for people to use...

The target audience would be people who are familiar with excel/vba but are frustrated with the lack of resources to do a healthy backtest of their strategies without paying for it.

Let me know what you guys think!! PM me/reply here if interested!
Oh, and please let me know if something like this already exists.
 
Last edited:

Jhet

Newbie
3 0
Hi

I would be very interested in seeing this developed further.

Thanks for your efforts.

Jhet
 

hyunski

Junior member
15 2
Here's the current version: http://adf.ly/hztRa

Feel free to play around with it, but don't flip it and try to sell it :)
You need to edit "Strategy" module in VBA to write your strategy. Comments should explain most things.

I'll get serious when there are more people but this should be enough to get started!
*Hint: haven't found any good trend following strategies that outperform buy and hold...but mean reversion does substantially better
 

Jhet

Newbie
3 0
Thank you very much.

I code a little in vba sometimes for work. I can see a huge amount of work has gone into this! This is really quite powerful.

Thanks again.
 

au2037

Newbie
1 0
dear hyunski may i please have a copy of this file? stuck on a project and this looks amazing.cheers
 

$oro$

Newbie
8 0
VBA backtesting

Hi,

I do most of my backtesting work in MATLAB and would be interested to see how VBA performs for similar functions.

I'll be moving to a new job that wouldn't grant me the request to a matlab license - would be great if I could have a look at your file. Would be more than happy to provide comments or help you with development!



Here's the current version: http://adf.ly/hztRa

Feel free to play around with it, but don't flip it and try to sell it :)
You need to edit "Strategy" module in VBA to write your strategy. Comments should explain most things.

I'll get serious when there are more people but this should be enough to get started!
*Hint: haven't found any good trend following strategies that outperform buy and hold...but mean reversion does substantially better
 
Last edited:

hyunski

Junior member
15 2
Hey, just PM me with your e-mail I'll send a copy.

Matlab is superior to VBA in terms of dealing with data and in-built functions, but I'm sure you'll get used to it!

Good luck!
 

rameshb345

Newbie
2 1
Hi Hyunski,

Request you to share the latest excel to me. rameshb345(at)gmail.com.

Please help me on this to use it for back testing.

Appreciate your help.

Thanks,
Ramesh
 

shahrachit

Newbie
1 0
Hi Hyunski,

Request you to share the latest excel to me. shahrachit(at)gmail.com.

Thanking you in advance.

Br/Rachit
 

BP48072

Newbie
5 0
Hyunski, could you please provide a working file url to download from? I have tried all the links provided in this thread but they all indicate "file was deleted".

Thanks.
 

tradethetrade

Newbie
8 0
This is my first post here so I won't spam with links, but there are much better tools to do basic and advanced backtesting that does not require programming at all. Even if you are really good at VBA, you'll get stuck at VBA's speed and architecture that were not designed for trading at all. Look up sites for algo trading and you find a ton of languages made exactly for trading. I coded a few robots myself using mql5.
 
 
AdBlock Detected

We get it, advertisements are annoying!

But it's thanks to our sponsors that access to Trade2Win remains free for all. By viewing our ads you help us pay our bills, so please support the site and disable your AdBlocker.

I've Disabled AdBlock