Pair Trading by using Global Variable

Questions about MultiCharts and user contributed studies.
Posts: 127
Joined: 05 Jul 2012
Has thanked: 9 times
Been thanked: 4 times

Pair Trading by using Global Variable

Postby ctu1121 » 15 Aug 2012

I use Global Variable to write pair trading strategy. I use US Stock XOM and CVX as my pair instruments. I assume the price of XOM and CVX will be diverged and converged sometimes during specific period. When the price diverged, I will buy and sellshort, when the price converged, I will sell and buytocover.

However, when trading via MultiChart64 with Interactiv Brokers, I met some problems. Sometimes, when the diverged condition is satisfied, the signal will trigger to buy ONLY, the signal didn't trigger the Sellshort position. Sometime, when the P/L combination of two position is satisfied, the pair should be sell and buycover. However, only sell position is triggered.

Here comes my questions:
1.Is there any setting I should change in Interactive Brokers?
2.Is there any setting I should change in MultiCharts 8 64bit?
3.Is there any attached program or function I should install into MultiCharts in order to use Global Variable?
4. mentions, it's important to determine "read-write action time", is there any example I could refer?

Thanks for your valuable advice and suggestion.

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 485 times

Re: Pair Trading by using Global Variable

Postby Dave Masalov » 17 Aug 2012

Hello ctu1121,

It is the question of implementing data exchange using Global Variables. It is quite hard to achieve synchronous diverged condition determination on two different charts.

Answer to questions 1-3 is no. As for the examples, unfortunately, the is no such sample code. It is not a trivial code and needs some time to be programmed. You should index the data that you transfer using GV, i.e. pass the bar number or synchronize it using the time. Please contact us directly if you are interested in custom programming services.

User avatar
Stan Bokov
Posts: 963
Joined: 18 Dec 2009
Has thanked: 367 times
Been thanked: 300 times

Re: Pair Trading by using Global Variable

Postby Stan Bokov » 17 Aug 2012

I would think that MultiCharts .NET would be better for this purpose of pair trading - you can send orders from one script to multiple brokers for multiple instruments. Check the MC .NET forum for more details.
These users thanked the author Stan Bokov for the post:
Andrew MultiCharts

Return to “MultiCharts”