Pairs Trading Backtest as One Strategy? - futures io
futures io

Pairs Trading Backtest as One Strategy?

Discussion in Platforms and Indicators

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

Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • 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 and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

Search this Thread

Pairs Trading Backtest as One Strategy?

(login for full post details)
  #1 (permalink)
Los Angeles, CA
Posts: 11 since Sep 2015
Thanks: 0 given, 3 received


Does anyone know which if any Retail Trading Platforms can backtest a Pairs Trading Strategy using only one chart and as only _one_ native strategy? (ie not two strategies with X and Y swapped in the second one)

1. Can Tradestation do this using Portfolio Maestro?
2. Can Multicharts do this using their Portfolio Trader?
3. Can Ninjatrader do this natively?

Importantly, I am looking for a platform that will natively shows the PnL total trading both legs in one dont want to have to add together two strategy reports outside of the platform. Also want to be able to optimize _one_ strategy and have it use the same parameters to trade both sides.


Reply With Quote

Journal Challenge April 2021 results (now extended!):
Competing for $1800 in prizes from Jigsaw
looks_oneMaking a Living with the Microsby sstheo
(602 thanks from 60 posts)
looks_twoSalao's Journalby Salao
(147 thanks from 26 posts)
looks_3Learning to Profit - A journey in algorithms and optionsby Syntax
(112 thanks from 26 posts)
looks_4Deetee’s DAX Trading Journal (time based)by Deetee
(94 thanks from 30 posts)
looks_5Maybe a little bit different journalby Malykubo
(46 thanks from 29 posts)
Best Threads (Most Thanked)
in the last 7 days on futures io
I finally blew up an account
494 thanks
Spoo-nalysis ES e-mini futures S&P 500
63 thanks
The Crude Dude Oil Trading System
62 thanks
The tiyfTradePlanFactory indicator
21 thanks
Building a Crypto Mining Rig
18 thanks
(login for full post details)
  #2 (permalink)
Legendary Market Wizard
Houston, TX
Experience: Advanced
Platform: Trading Technologies
Broker: Primary Advantage Futures. Also ED&F and Tradestation
Trading: Primarily Energy but also a little GE, GC, SI & Bitcoin
Posts: 4,088 since Dec 2013
Thanks: 3,398 given, 8,092 received

The way I have done it in Tradestation before is as follows.

Assume we have two Instruments X and Y.
Chart 1 has X as data1, X as data2, Y as data3
Chart 2 has Y as data1, X as data2, Y as data3

Write a single strategy for the pairs trade. At the beginning of the strategy you have some simple code that detects whether data1 is equivalent to data2 or data3. Now the strategy knows which instrument the chart is trading. So when it comes to executing orders you do something like "if data1 is same as data2 then execute orders for X otherwise execute orders for Y".

As you state the problem with this is that you have two performance reports and two sets of trades and you need to do your own calculations to add them together, which is a major pain if you are doing optimizations.

In theory you should be able to do it in Maestro though, which should combine the results into a single performance chart for you.

Reply With Quote
(login for full post details)
  #3 (permalink)
San Antonio, TX
Posts: 27 since Apr 2020
Thanks: 7 given, 6 received


1) Did you figure this out? Trying to run a pairs trading strat as well

2) What are you entry and exit points? I'm just not sure how to implement a pairs trading strat successfully. When I throw two instruments on tradingview, its seems apparent which to go long and short on. But when you move the time of the chart/zoom in and out, the relationship changes. Maybe I would just have a point in time that is the starting point and once the prices diverge open the trade and exit when applicable, and then just keep moving the start time of when to calculate percentage change?

Let me know if you have any ideas please sir/maam! Sorry if this is somewhat obscure.

Reply With Quote
(login for full post details)
  #4 (permalink)
Los Angeles, CA
Posts: 11 since Sep 2015
Thanks: 0 given, 3 received


Thank you for your awesome idea - I have coded that up and will have it running in TS Portfolio Maestro shortly.

Jkepha, as you can see this is still an open issue. It is very frustrating that no retail platform offers a good Pairs trading solution (ie not having to use two charts).

My current plan:

1. TS Portfolio Maestro
2. Multicharts Portfolio Trader (but I have issues with their builtin Pairs Strategy - I dont like it)
3. Matlab

I have Matlab working but so maybe I should just run with that.


Reply With Quote

futures io Trading Community Platforms and Indicators > Pairs Trading Backtest as One Strategy?

Last Updated on March 13, 2021

Upcoming Webinars and Events

NinjaTrader Indicator Challenge!


Journal Challenge w/$1,800 in prizes!

May 7

The Cold Hard Truth: Maybe I Am Not Good Enough w/Chris Gray @ Earn2Trade

Elite only

Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, 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.
no new posts