Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
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()
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.
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.
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.
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.