As I have no real idea what a Global Variable is, nor how to code it, would it be possible for somebody to post an example of how to do this including some very simple strategy e.g. Moving average crossover, using Stock 'A' versus Stock 'B' and any additional code required to ensure that both sides of the pair are executed as in the above quote. Thanks in advance.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 possible for both products in Portfolio Backtester by means of Global Variables. Multiple data series should be allocated in correct order in Portfolio Backtester, 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.
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).
Pair Trading in Backtesting .... Using Global Variables
Questions about MultiCharts and user contributed studies.
1 post • Page 1 of 1
Following on from recent posts regarding Pair trading using MC, I noticed on the Wiki pages that it is indeed possible to backtest Pairs in Portfolio Backtester using Global Variables.