Unilateral Pairs Trading Indicator

Unilateral Pairs Trading Indicator


Summary


Based on James Altucher’s book Trade Like a Hedge Fund: 20 Successful Uncorrelated Strategies & Techniques to Winning Profits (Wiley Trading), this useful indicator is great for pairs traders that would like to trade only one side of a pair. I really recommend that you buy James Altuchers book, or at least check it out from the library. His book describes Unilateral Pairs Trading in depth, as well as several other trading techniques for high profits, and just general trading thoughts that are highly refreshing. The download includes 2 indicators and a bonus showme for buy/sell conditions At this time, the indicator is just for TradeStation, but as you all know, I’ll get it into NinjaTrader soon!! NinjaTrader was missing a key function I needed, that I’m having to create by hand.

Screen Shots

Usage


James Altuchers book Trade Like a Hedge Fund: 20 Successful Uncorrelated Strategies & Techniques to Winning Profits (Wiley Trading) was my inspiration for the Unilateral Pairs Trading technique that he outlines in chapter 2. I’ve code up a simple TradeStation ShowMe to indicate buy conditions. You can turn on sell conditions too, but I’ve got some improvements to do on that half, so don’t say I didn’t warn you ;) The idea is that when two pairs are trading that are highly correlated ( I use pairs with a correlation value > .85, but that’s just me) they will shift out of sequence with each other for short bits of time, and statistically they will “re-converge”

And how do I find 2 stocks that are highly correlated like that? Well, I wrote a program to analyze all the stocks, and compile them into a list, and tell me which ones are highly correlated :) You know, the easy, lazy programmers way!! I used to have it online, but there wasn’t enough interest to keep it going. If I was to get a sudden surge in interest, I’d consider putting it back online again…. I might even make it free!! Just let me know if you prefer online, or a desktop app you run at home.

So now that you have a highly correlated pair, how to you apply it to the Unilateral Pairs Trading technique that James Altucher outlines? Well, basically for a long buy, and the ShowMe takes the work out of it, if the standard deviation of some calculated ratios is less then -1.5 (modifiable to suit your trading style) AND the percent change in price is greater than 2%, then you have a buy signal. On the other hand, if you have 1.5 standard deviations and greater than -2% change, then you have a short sell trading opportunity. There is more to it than that, and James Altuchers book is really great to read for insight into how this, and many other, trading techniques work for hedge fund managers

Downloads

Download Unilateral Pairs Trading Indicator (ELD and Workspace)

The download for Unilateral Pairs Trading is broken.

Happy Trading!

Tags: , , , , ,

banner ad

13 Responses to “Unilateral Pairs Trading Indicator”

  1. robin says:

    where could I download the unilateralPairs_Altucher.dll file ? thank you

  2. robin says:

    sorry,I could not find the UnilateralPairs_Altucher.dll,where to download it?
    thank you

  3. kannon says:

    Can you please double check on his indicator? It does not work because the unilateralPairs_Altucher.dll file is missing. Thanks

  4. Andrej says:

    Did somebody get UnilateralPairs_Altucher.dll?

  5. Rich says:

    Ditto on the request for "UnilateralPairs_Altucher.dll"

    Thanks.

  6. Greg says:

    same issue re: missing .dll

  7. Hi Guys –

    I don’t have a copy of TradeStation anymore, and I can’t find a .dll, so I’m flying blind on this.

    It’s been a long time, so you may have to help me remember.

    I don’t think that the .dll is really needed.

    Try to comment out or remove the lines the are calling the dll file (Tazatek.dll ? )

    If that doesn’t work, send me the text of the .eld file, and I’ll see if the .dll is really needed, or if there is a way to fix this.

    I’ve had so much response on this, that I may need to reaquire my developer copy of TradeStation to help out again.

    Sorry for the delays, my wife finished a book on Social Media Marketing ( http://www.moxiemafia.com/blog and http://www.moxiemafia.com ) and I’ve been helping her out, as all good husbands do

    PS – I had a site up that created correlated pairs for all the stock symbols, is this something that would be useful to put up again?

  8. Rich says:

    Matthew-

    Thanks for the comeback. Looking at the EL, it appears that the .dll in question is very important. Here is the text for the two EL files that call for the .dll:

    external: "UnilateralPairs_Altucher.dll", double, "T_unilateralPairs",
    IEasyLanguageObject {self},
    int { ma(ratio) },
    int { ma(ratio – ma(ratio) },
    int {StdDev} ;
    external: "UnilateralPairs_Altucher.dll", double, "T_unilateralStdDev", IEasyLanguageObject {self};
    external: "UnilateralPairs_Altucher.dll", int, "T_init", IEasyLanguageObject {self};
    #events
    onCreate = T_init;
    #end

    input:
    UpperBand(-2.0),
    LowerBand(-.5),
    movAvg_1(20),
    movAvg_2(20),
    movAvg_3(20);

    var:
    dummyVal(0), expr(0);

    dummyVal = T_unilateralPairs(self, movAvg_1, movAvg_2, movAvg_3);
    expr=T_unilateralStdDev(self);

    plot1(UpperBand, "upper", lightgray);
    plot2(LowerBand, "lower", lightgray);
    plot3(0, "Zero", magenta, default, 1);
    plot4(expr, "StdDev", yellow);
    plot5(expr, "StdDevLine", red);

    ____________________________________________________

    external: "UnilateralPairs_Altucher.dll", double, "T_unilateralPairs",
    IEasyLanguageObject {self},
    int { ma_ratio },
    int { ma_maRatioDiff },
    double { stdDev_thresholdBuy},
    double { stdDev_thresholdShort},
    double { stdDev_thresholdSell },
    double { stdDev_thresholdCover};

    external: "UnilateralPairs_Altucher.dll", double, "T_unilateralRatio", IEasyLanguageObject {self};
    external: "UnilateralPairs_Altucher.dll", double, "T_unilateralMaRatio", IEasyLanguageObject {self};
    external: "UnilateralPairs_Altucher.dll", double, "T_unilateralStdDev", IEasyLanguageObject {self};

    external: "UnilateralPairs_Altucher.dll", int, "T_init", IEasyLanguageObject {self};

    #events
    onCreate = T_init;
    #end

    inputs: dbg(0);

    var:
    plotVal(0),
    ma_ratio(20),
    ma_maRatioDiff(20),
    thresholdBuy(1.5),
    thresholdShort(-1.5),
    thresholdSell(-.5),
    thresholdCover(.5);

    plotVal = T_unilateralPairs(self,
    ma_ratio,
    ma_maRatioDiff,
    thresholdBuy,
    thresholdShort,
    thresholdSell,
    thresholdCover );

    // plot1(plotVal, "mainLine");
    plot2(T_unilateralRatio(self), "Ratio");
    plot3(T_unilateralMaRatio(self), "MA_Ratio");
    plot4(T_unilateralStdDev(self), "StdDev");

  9. Gelo says:

    I don’t use Tradestation anymore, actually I’m using Metastock.

    Does anyone knows how to translate this formula to Metastock language?

    With regards
    Gelo

  10. Neil says:

    Hi, is it possible to get the prog that will sort all stocks looking for correlated pairs as a desktop.

    Alos, any news on getting the .dll

    Many thanks, Neil.

  11. Evan says:

    So if this dll is so important, What do we do now? Is there a UnilateralPairs_Altucher.dll file that someone has and if so where do we place it.
    Matthew,Can you share the dll file or rescript the code for TradeStation 8
    Thanks Evan

  12. Evan,

    I’ve sent you a .dll file that appears to be the right one. Could you test it out for us, and if it’s the right one, I’ll add it to the post for others to use.

    Matt

  13. Jon says:

    Matt,

    Hey, can you send me the dll file please? Any idea where this library came from?

    thanks,

    Jon

Leave a Reply

CommentLuv Enabled