Changes

Jump to navigation Jump to search

Spread and Pair Trading

272 bytes added, 17:04, 27 April 2017
no edit summary
==Exchange Traded Spreads==
In MC MultiCharts one is able to trade on a spread only if it is exchange traded spread and it is provided by your data vendor as a single separate instrument that is added to QuoteManager database (see Adding Symbols to Database) and mapped correctly to the corresponding broker instrument in [[Symbol Mapping]] window. If there is no such instrument on data source end and at your broker, then it is not possible to trade exactly on such spread.
==Visual Spread on Chart==
To see a spread histogram of 2 instruments, one needs to plot a chart window with 2 symbols as data series 1 and data series 2. In the list of our prebuilt studies there are 2 spread indicators that can be applied to such chart: Spread - Diff and Spread - Ratio. See [[Using Studies|the following article]] on how to use studies in MultiCharts. The default studies can be modified to plot the spread you need, e.g. using the [[PlotPaintBar|PlotPaintBar]] keyword to create OHLC bars.
==Pair Trading in Real-Time==
One can only send orders to buy or sell one or another instrument of a pair in MultiCharts, but to reach this goal the following system should be developed:
* 2 separate chart windows should be plotted with both symbols of a pair on the charts.
* On the first chart the symbol A should be plotted on subchart 1. The symbol B should be plotted on subchart 2.* On the second chart the symbol B should be plotted on subchart 1. The symbol A should be plotted on subchart 2.* On both charts the strategies should be applied that has have similar but reversed logic should be applied to buy for the 1st chart and to sell for the 2nd one (orders can be placed only on data series 1).
<div style="background-color: #E5F6FF;">'''Example''': When one of the pair is bought or sold, your strategy needs to know exactly what’s going on with both symbols. If your pair is Google and Microsoft, you would enter GOOG as symbol one and MSFT as symbol two on first chart. Then you would add MSFT as data one and GOOG as data two on second chart. On first chart when a condition on data 1 is met the strategy buys and at the same time when this very condition is met on the second data series of the second chart that strategy sells and vice versa. This way each instrument in the pair is actively referencing the other instrument—and you achieve complete synchronization. </div>
==Pair Trading in Backtesting==
It is not possible to use Global Variables for backtesting of your pair-trading strategy either in regular MultiCharts, or in MultiCharts .NET. However it is possible for both products in Portfolio Backtester Trader by means of Global Variables. Multiple data series should be allocated in correct order in Portfolio BacktesterTrader, so it is possible to perform pair trading, using GV, because of vertical bar-by-bar calculation of the strategy on all of your data series.
<div style="background-color: #E5F6FF;">'''Example''': When you have GV on first series, you should be able to get those GV when script is calculated on next data series. The calculation of the script is sequential. It means that the script is first calculated on bar 1 of data A and it generates a sell order (as an example) and passes a value through global variable. Then the script is calculated on bar 1 of data B where it reads the global variable and generates identical buy order. Though everything happens sequentially, in fact the sell and buy orders are generated on the bars with the same timestamp (if data A and data B have identical series).</div>
[[Category:FAQ]]

Navigation menu