Multi-instrument strategy (Page 2) - NinjaTrader Programming | futures trading

Go Back

> Futures Trading, News, Charts and Platforms > Platforms and Indicators > NinjaTrader > NinjaTrader Programming

Multi-instrument strategy
Started:July 3rd, 2013 (10:57 AM) by jnorris Views / Replies:3,784 / 14
Last Reply:February 4th, 2014 (02:02 AM) Attachments:0

Welcome to

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community. It's free and simple, and we will never resell your private information.

-- Big Mike

Thread Tools Search this Thread

Multi-instrument strategy

Old July 3rd, 2013, 04:41 PM   #11 (permalink)
OC, California, USA
Futures Experience: Advanced
Platform: IB/TWS, NinjaTrader, thinkorswim
Favorite Futures: stocks, options, futures, VIX
shodson's Avatar
Posts: 1,828 since Jun 2009
Thanks: 470 given, 3,155 received

To address your specific example, just add each instrument, as specified, but they all have to be on the same time frame as the primary instrument. So if you're trading AAPL on 5min bars, for example, and you also want to trade Intel, Cisco, Oracle, Microsoft, then you just add them in OnInitialize()

Add("INTC", PeriodType.Minute, 5);
Add("CSCO", PeriodType.Minute, 5);
Add("ORCL", PeriodType.Minute, 5);
Add("MSFT", PeriodType.Minute, 5);
However, multi-instrument strategies are more appropriate when you want to trade one specific instrument, but you want to examine another instrument to make decisions, like trading SPY while watching the VIX.

Or, another typical scenario is if you want to examine or trade the same instrument but on a different time frame, like trade the SPY on a 15min time frame but decide when to enter/exit based on price action on the 3min time frame.

As for your example, I would just create one strategy for one insturument and then run multiple instances of the strategy, one for each instrument. This decouple's the strategies from trying to manage multiple instruments, which is more complicated, and just dedicates one strat per stock. Also, you can more easily backtest a group of stocks like the DOW 30 or the entire S&P 500 by just running a test across an entire instrument group without having to change code every time you want to test different instruments.

As far as looking for some examples, see the SampleMultiInstrument strategy that comes with Ninjatrader. Also, make sure you go through this topic on multiple instruments at NT's site a few times.

Last edited by shodson; July 3rd, 2013 at 04:46 PM.
Reply With Quote
The following 4 users say Thank You to shodson for this post:

Old July 6th, 2013, 12:05 AM   #12 (permalink)
Elite Member
Charlotte, NC
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: ES
Posts: 8 since Jun 2013
Thanks: 2 given, 1 received

@shodson Fantastic info, thanks! This is exactly what I was looking for including pointers on what to study next.

Reply With Quote
The following user says Thank You to jnorris for this post:

Old September 12th, 2013, 08:40 PM   #13 (permalink)
Elite Member
Irvine CA/USA
Futures Experience: Intermediate
Platform: NinjaTrade,Amibroker,Tradelink
Favorite Futures: Stocks
Posts: 3 since May 2013
Thanks: 1 given, 1 received

One of the big advantage on running a portfolio of symbols in the same strategy is that you can use portfolio statistics. For example, you can

1) Exit the strategy when the P/L reach a limit for all the symbols.
2) You can limit the number of trades for the entire list of symbols.
3) You can limit how much money the strategy will buy/sell.

If I had a portfolio of 100 symbols, would managing them in the strategy be difficult ? Sounds like a simple feature NT should have. Amibroker and Tradelink works at the portfolio level, not at the symbol level.

Anyone having any success with this ? Thanks.


Reply With Quote

Old September 13th, 2013, 09:03 AM   #14 (permalink)
Elite Member
London, UK
Futures Experience: Beginner
Platform: NinjaTrader, home-grown Java
Broker/Data: IB/IQFeed
Favorite Futures: EUR/USD
Adamus's Avatar
Posts: 1,083 since Dec 2010
Thanks: 467 given, 775 received

Yes exactly, it's a definite missing feature in Ninja and it's not going to be in NT8 either. Guess they decided it wasn't in their interests to code it - maybe it was too much of a night to fit it into their application architecture, and not enough people demand it.

It is not difficult to code multi-instrument strategies. It's not a big deal at all if you already coding multi-time-frames, but it's not facile. You have to be rigorous and it's all extra work, compared to doing portfolio management through a GUI by using a mouse to select a portfolio of strategy-instrument pairs (which is presumably what NT's competition allows you to do).

You can discover what your enemy fears most by observing the means he uses to frighten you.
Reply With Quote

Old February 4th, 2014, 02:02 AM   #15 (permalink)
Elite Member
Irvine CA/USA
Futures Experience: Intermediate
Platform: NinjaTrade,Amibroker,Tradelink
Favorite Futures: Stocks
Posts: 3 since May 2013
Thanks: 1 given, 1 received

Futures Edge on FIO

What happens to the S&P 500 when a new President takes office?

I found a solution to running multiple instruments strategy and using portfolio statistics. Run a simple strategy per symbol but have them all read/write to a shared text file. Thus, you can put portfolio type information into this file. Be very careful on how often and how much you read/write to this file. I was able to run a 200 symbols strategy with no problem.


Reply With Quote

Reply > Futures Trading, News, Charts and Platforms > Platforms and Indicators > NinjaTrader > NinjaTrader Programming > Multi-instrument strategy

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Upcoming Webinars and Events (4:30PM ET unless noted)

An Afternoon with FIO trader bobwest

Elite only

NinjaTrader 8: Programming Profitable Trading Edges w/Scott Hodson

Elite only

Anthony Drager: Executing on Intermarket Correlations & Order Flow, Part 2

Elite only

Adam Grimes: Five critically important keys to professional trading

Elite only

Machine Learning Concepts w/FIO member NJAMC

Elite only

MarketDelta Cloud Platform: Announcing new mobile features

Dec 1

NinjaTrader 8: Features and Enhancements

Dec 6

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with a Multi-Instrument Indicator ECI Ed NinjaTrader Programming 12 July 31st, 2013 09:22 AM
Instrument multiplier/divider by other instrument, name of that? raffu NinjaTrader Programming 4 August 24th, 2011 02:37 AM
Multi-Timeframe in a strategy max-td NinjaTrader Programming 30 July 22nd, 2010 12:35 PM
Ninja Strategy multi-timeframe issue/Strategy to indicator nw123 NinjaTrader Programming 2 December 20th, 2009 06:24 PM

All times are GMT -4. The time now is 06:19 AM.

Copyright © 2016 by 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.
no new posts

Page generated 2016-10-25 in 0.09 seconds with 19 queries on phoenix via your IP