Intermarket - Pseudo code to create a strategy on this relationship

Discussion in 'Strategy Building' started by lmseldin, Jun 9, 2023.

  1. lmseldin

    lmseldin

    Here is a comparison of two assets (the Dollar and Gold).

    upload_2023-6-9_13-28-10.png


    I added Bollinger Bands around both assets and have added a factor so I can plot both charts on the same chart.

    For me, I can see the pairs trading by visually seeing that maybe the spread will grow. What I am asking is how would I program this into a trading system. Meaning I can see this visually, but I would like to see this relationship through code to see how to program a strategy on this.

    Thank you,
    Larry
     
  2. spy

    spy

    Bruv, contrary to all the AI hype going around these days computers still aren't magical inference engines that can come up with details they aren't given ahead of time.

    From what you've described so far all we've got is:
    Code:
    # buy one
    # sell the other
    You can thank me by sending a fat check after you've made your millions ;-)
     
    SunTrader likes this.
  3. SunTrader

    SunTrader

  4. lmseldin

    lmseldin

    Sun,
    Preferably code for Wealthlab, but I was asking for pseudo code in English. So I can understand how I can strategize what I see visually.

    Thank you,
    Larry
     
  5. murray ruggiero, rip, his I-system that was popular in the early 2000 utlized correlation like this for different markets as to find when they are in correlation or inverse correlation for trading different approaches. I don't remember more, but if you research him and I master you should get some more detailed info hopefully
     
  6. spy

    spy

    Are you afraid your English isn't good enough? Just give it a shot... you might surprise yourself. Here, I'll start you off in a less cynical way...

    Code:
    tickers = a list of tickers i got by picking my nose
    for each ticker combination
      draw Bollinger bands (whatever those are, tbd)
      if the bands touch: # i guess
        then print a message
    
    msgs = collect all messages
    for each m in msgs:
      buy m(1)
      sell m(2)
    
    # exercise left to the reader
    # omg look at me, I'm a senior dev
    I'll take the million whenever you're ready :p
     
  7. 2rosy

    2rosy

    what's the makeup of DXY? probably cheaper to just trade gold priced in euros (or swiss or yen)
     
  8. Sekiyo

    Sekiyo

    You want us to write some pseudocode in English about what you’re visually seeing ?

    Mort de rire
     
  9. Sprout

    Sprout

    You'd do better pairing risk/on with risk/off
     
    spy likes this.
  10. Real Money

    Real Money

    Using futures...

    The ICE NYBOT contract is $1000 times the quote on DXY. The gold contract is $100 times the one-hundred troy ounce contract on COMEX.

    So, you have ($1000 * DX) - ($100 * GCM3) = USDX/GOLD cross.

    Get software that can chart this, build an algo, and trade the spread. Can use algo logic on either leg of the trade, the cross itself, and/or FX rates, the bond market, equities markets, etc.
     
    #10     Jun 10, 2023
    theledger likes this.