February 22

9 comments

Trading Multiple Strategies With The Same Instrument – Part 1

By Kevin Davey

February 22, 2016

Automated Trading Development, Kevin Davey, portfolio management

Tradestation is a pretty amazing testing and development platform. I’ve been using it for over 10 years, and I’ve been very happy overall with it. Sure, there are certain aspects of it I don’t like, and certain things that are hard to do, but I think that is true of almost any platform.

My biggest pet peeve with Tradestation is that it is hard to trade 2 automated strategies in the same market at the same time. Why is this even important? Why not just trade the best strategy, and shelve the one that does not perform as well? Many people do just that; unfortunately they usually pick the wrong strategy to trade!

I take the opposite approach in my trading – I assume that I don’t know what strategy will perform best in the next 6 months, or at any point in the future. Plus, I also assume that all strategies will eventually break, and have to be retired. So, I want plenty of strategies for each market, and I want to trade them all. This leads to diversification, which has been known for years to smooth out the overall equity curve.

With that in mind, consider the equity curves and code for two very simple strategies. Shown in Figure 1 is a momentum strategy, and Figure 2 depicts a simple moving average system. Both are applied to daily Crude Oil bars for the past few years, and do not include slippage or commissions. If you traded both at the same time, you’d want the equity curve to look like Figure 3, which is just the daily sum of the two strategies.

Fig 1

Fig 2

Fig 3

So, how could you do this – trade 2 strategies in the same market at the same time- in Tradestation? There are quite a few options to do this. Unfortunately, all have advantages and, most importantly, disadvantages.

Option 1 would be to insert the two strategies on the same chart. That leads to decent results in this particular case, as shown in Figure 4. But, it does not equal the equity curve we want (although in this case it is fairly similar), shown earlier in Figure 3. In general, this is not a good alternative. Too many times, inserting two strategies on the same chart will lead to terrible results.

Fig 4

Option 2 would be to combine the code for each strategy into one “super code” and trade that.  The code for each would be cut and pasted into the “master” code, with no changes at all.  With this technique, however, the resulting strategy still does not mimic the curve we want.  This is especially true if the strategy uses Tradestation reserved words, such as openpositionprofit  and market position.  This method is just another disappointment.

Option 3 is to trade each strategy, in a separate chart, in the same account.  Depending on the code, though, this option can be fraught with disaster.  For example, you cannot use the Trade Manager Position Match feature any longer, so you’ll never know if your real life positions match both strategies.  And that is just the tip of the iceberg. Stop losses, market position based rules and many other nuances in Tradestation make this a very difficult alternative.  The end result with this option, based on my personal trading experience, is that it just is not a feasible option.

Option 4 is to trade each strategy in its own chart window, and use a third party tool to manage or enter the positions.  This is a good solution, but there is a fee for this 3rd party software. Some possible software packages that may help you with this option:

http://www.independenttrader.com/

http://www.traderssoft.com/wp/ts/software/software-ts9/

http://www.ninjatrader.com

Of the three, I have only used the Ninjatrader option to send orders from Tradestation thru Ninja to another broker.  But, I did not use this interface specifically to trade multiple strategies with one instrument.  One of these solutions may work for your particular case.

Option 5 is to trade each strategy in its own chart, in its own account.  So, if I had 3 ES strategies, I would trade each strategy in a separate account, meaning I’d need 3 accounts.  This is the method I have primarily used.  It has its advantages – it makes bookkeeping each strategy a bit easier, and the strategies can be tracked fairly easily in Tradestation’s Trade Manager.

But, the approach also has its downside.  For instance, it is a very non-optimal way to use margin.  If I go long in one account 1 contract of ES, that ties up $5060 in margin.  And if I go short 1 ES in another account, it would tie up another $5060.  So, I end up with 2 positions, in opposite directions, meaning in reality I am net flat, and instead of needing $10,120 in margin, I should need $0!

Although there may be other potential solutions to the problem, I am going to with Option 6.  This solution involves summing up position in multiple strategies, and then just trading to reach the net position.  For example, if strategy #1 was long, that would be +1.  If strategy #2 was also long, that would be +1 also.  Summed up, that would mean you should be +2, or long 2 contracts.

The nice thing about this solution is that you could potentially trade many strategies at the same time, and have the result traded through and depicted on only one chart.  So, each individual strategy could be evaluated separately (using the Strategy Factory process, I teach for example), and then it could be “added” to other profitable strategies.

“Decoded: trading multiple strategies the right way for system traders”

Click to Tweet

In theory, that seems like an easy proposition.  Just sum up positions, and trade the net.  But, reality is quite a bit tougher, due to the way Tradestation works, and also just due to the nature of the problem.

In the next installment of this series, we will take the first step towards creating a “super” strategy that trades 2 strategies – creating strategies that perform similarly to the original strategies of Figure 1 and 2, but that will lend themselves to being combined into the super, master strategy.

If you would like to learn more about building trading systems be sure to get a copy of my latest book, Building Winning Algorithmic Trading Systems.

Other Articles in This Series

Trading Multiple Strategies With The Same Instrument – Part 2

Kevin Davey

About the author

Kevin Davey is a professional trader and a top performing systems developer. Kevin is the author of “Building Algorithmic Trading Systems: A Trader's Journey From Data Mining to Monte Carlo Simulation to Live Trading” (Wiley Trading, 2014.) . He generated triple digit annual returns 148 percent, 107 percent, and 112 percent in three consecutive World Cup of Futures Trading Championships® using algorithmic trading systems.

His web site, www.kjtradingsystems.com, provides trading mentoring, trading signals, and free trading videos and articles. He writes extensively in industry publications such as Futures Magazine and Active Trader and was featured as a “Market Master” in the book The Universal Principles of Successful Trading by Brent Penfold (Wiley, 2010).
Active in social media, Kevin has over 15,000 Twitter followers. An aerospace engineer and MBA by background, he has been an independent trader for over 20 years. Kevin continues to trade full time and develop algorithmic trading strategies.

  • This is a genuine huge problem in trading.

    a potential solution is to write your own position manager and persist to a file in case you restart tradestation.

    i avoided this problem by writing my own traing platform.

  • Thanks for the comments – you bring up a couple more options that I did not mention. Pretty cool that you developed your own platform!

    Please let me know what you think as I further explain the idea in Parts 2 and 3. In my testing so far, it has worked well, so it may be a decent solution for many, but it will not be ideal for everyone.

    I suspect your trading platform does exactly what you want in this regard, which is awesome.

    Thanks!

  • I’ve been battling this exact problem the past 2 years…I ended up going w/ option 5 as that was the only way I could figure it out with my less than stellar coding skills. Looking forward to seeing how you solved this issue.

    • I can’t say I’ve solved it, but as you will see, it does seem to work pretty well. Some tradeoffs are necessary, but I think the benfits outweigh the disadvantages…

      Thanks for the comment!

    • hi Kevin, will do.
      another important issue I encountered when running multiple strategies; is the throughput. When more than one strategy is sending an order at the same time; latency goes much higher; and it may take few seconds to finish them up; not to mention ‘timeout errors’.

      for a serious systematic trader; who wish to run multiple strategies; Tradestation, Metatrader, TradeNavigator, etc are unfortunately not suitable.

      however these platforms are great for research and development. I still use some of them for that purpose.

      • Yes, that is a concern, especially if you have limit orders, cancel a lot of orders, run on short time frames, etc. I usually swing trade, without a lot of orders, and almost never use limit orders. So, the approach I lay out in this series can work well in those cases…

  • Hi Kevin!

    I’m not a tradestation user jet but I saw that there is a feature that says: “Allow multiple automated strategies on multiple charts using the same futures/forex symbol on the same account”. I thought that checkbox would make tradestation aware of what strategy took what trade?
    I currently use Multicharts and I have not run into this problem there.

    • Theoretically this should work, but in reality it is tough. For example, if you use certain keywords (like openpositionprofit), there can be confusion with the combining of strategies (does openpositionprofit apply to both, just first position, just second, etc?).

      I would give it a try in real time, and see though. It may work out for your strategies. My experience is that it did not work well for me.

  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

    Learn To Code & Build Strategies
    Using EasyLanguage. 

    >