NexusFi: Find Your Edge


Home Menu

 





Backtest multiple instruments w. one position?


Discussion in Platforms and Indicators

Updated
    1. trending_up 1,655 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 5 posts
    2. attach_file 0 attachments




 
Search this Thread

Backtest multiple instruments w. one position?

  #1 (permalink)
diamondfish
Stockholm + Swedem
 
Posts: 4 since Jul 2013
Thanks Given: 0
Thanks Received: 0

Hi everyone,

I want to backtest several trading systems on multiple instruments, Stocks listed in the OMXS30 (Swedish index). I want this to be simulated like "real" trading, and therefore I want to limit the positions open at any given time. The most simple case would be testing only one trading system, that maybe generates 100 buy signals per year in total for ALL the 30 stocks and keep ONE position open at most at any given time. So I want something like this:

For every bar in the backtesting:
  1. Iterate through all X open positions to see if any of them should be closed.
  2. Check if we have any of the N available positions to fill, if so: continue
  3. Iterate through all stocks and check if any of the M models generates a buy signal. Continue till all positions are filled or the iteration is completed.

All softwares I tried supported backtesting only with individual results for each stock. I want to do a little bit more of a realistic approach where Time-In-Market and all stocks are taken into account. It would be nice to prioritize the models as well.


Is there any software out there capable of this?



Best Regards,
diamondfish

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Better Renko Gaps
The Elite Circle
Deepmoney LLM
Elite Quantitative GenAI/LLM
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
Futures True Range Report
The Elite Circle
 
  #3 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629


It's possble with NInjaTrader, with a single strategy using multiple instruments.
As the OMX has only 30 instruments, with a good coding methodology the code should not be too ugly, and fast enough.
Some other software should be able to do something similar, I can't say for sure.

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
  #4 (permalink)
diamondfish
Stockholm + Swedem
 
Posts: 4 since Jul 2013
Thanks Given: 0
Thanks Received: 0


sam028 View Post
It's possble with NInjaTrader, with a single strategy using multiple instruments.
As the OMX has only 30 instruments, with a good coding methodology the code should not be too ugly, and fast enough.
Some other software should be able to do something similar, I can't say for sure.

I've only used NT very briefly. How would this be set up for let's say a simple moving average strategy? Is there any code examples I could use? How do I backtest? (In NT I've only selected the instruments I want, and got individual results for each of them).

Reply With Quote
  #5 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629


diamondfish View Post
I've only used NT very briefly. How would this be set up for let's say a simple moving average strategy? Is there any code examples I could use? How do I backtest? (In NT I've only selected the instruments I want, and got individual results for each of them).

There is already a multi-instruments strategy installed by default, so you can take a look at it.
In few words, it's easy, there is already a lot of examples on futures.io (formerly BMT), and you'll easily find some help.

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
  #6 (permalink)
diamondfish
Stockholm + Swedem
 
Posts: 4 since Jul 2013
Thanks Given: 0
Thanks Received: 0


sam028 View Post
There is already a multi-instruments strategy installed by default, so you can take a look at it.
In few words, it's easy, there is already a lot of examples on futures.io (formerly BMT), and you'll easily find some help.

Of what I can see it's easy to add instruments to compare the active instrument to. But EnterLong() and other exit/entry functions only uses the active instrument, right? The one added to the backtest through the GUI. To perform a multi-instrument backtest as I described, I then need to create 30 backtest strategies? Perform each and everyone on all stocks, and then add all results together for the cumulative backtest. But I won't get any equity chart etc. So to me it doesn't seem that easy

I'm not an elite member on futures.io (formerly BMT), so maybe that's why, but I didn't find any multi-instrument strategies on futures.io (formerly BMT) that helped me with what I want to do. If anyone has any more tips and/or can guide me towards more information, I'm very grateful.

Reply With Quote




Last Updated on January 28, 2014


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts