Fully automated futures trading

Discussion in 'Journals' started by globalarbtrader, Feb 11, 2015.

  1. KevinBB

    KevinBB

    The half dozen or so blog posts you wrote on small account optimisation were a good read, the ideas behind them understandable (for me), however the coding is a bit out of reach for an an ancient programmer like me. It will be interesting to see if your new increased instrument universe has any affect on overall performance.

    So, yes, conservative is good. I'd prefer to stick to something I understand. I'm pretty confident in the system now, but still won't increase risk much more until the new year.

    KH
     
    #2921     Oct 11, 2021
  2. newbunch

    newbunch

    Rob,

    The code is a bit confusing to me. When does the new dynamic optimisation method remove instruments in which you already have a position? Does it wait until system wants to have a zero position or is going to reverse? Or does it wait until it's close to zero, perhaps anything less than half a contract? Or something more sophisticated I'm not seeing?

    Thanks in advance.
     
    #2922     Oct 11, 2021
  3. Er... it doesn't? Why would it do that?

    GAT
     
    #2923     Oct 12, 2021
  4. newbunch

    newbunch

    I guess "remove" is the wrong word since the system never removes instruments. I meant, when does the system "close" an existing position? Obviously, I'm not understanding how the new system works.
     
    #2924     Oct 12, 2021
  5. Most likely when the optimal position (generated from forecasts) goes to being a different sign to the current position. So if we're long, but then the forecast goes short, we'll close our position. We could also close earlier if the optimal position gets small enough, and the trading costs aren't too heavy.

    GAT
     
    #2925     Oct 12, 2021
    newbunch likes this.
  6. newbunch

    newbunch

    Thanks. That's what I was getting at.
     
    #2926     Oct 12, 2021
  7. newbunch

    newbunch

    GAT,

    After a lot of thinking and a little bit of work, I was able to implement this tracking error minimization technique in Excel. Actually, it took less than 2 hours to create and troubleshoot the necessary sheets and write the Visual Basic code.

    The only problem is that my so-called greedy algorithm is slow to run because Visual Basic is notoriously slow reading and writing from Excel and there's a lot of that going on (and because I'm working on a 5-year-old laptop). Fortunately, I can run this the prior evening, so it doesn't matter too much.

    How long does it take the algorithm to run in Python? I'm sure it's faster, but how much faster? (If I'm reading your code correctly, I believe my greedy algorithm is a slower methodology but one more likely to get closer to the optimal solution, though I'm sure the difference would be small. Next step will be trying to figure out ways to improve the speed of the algo.)
     
    #2927     Oct 17, 2021
  8. userque

    userque

    Did you turn off screen updating?
     
    #2928     Oct 17, 2021
  9. newbunch

    newbunch

    Of course!
     
    #2929     Oct 17, 2021
    userque likes this.
  10. userque

    userque

    Figured ... but had to ask. :)

    There are more advanced techniques, like putting everything in one sheet, vs. multiple sheets, if possible. 2. Splitting the problem up, and running multiple Excel instances. 3. Converting formulas to values before running loops, when the formulas don't change values.

    Regarding your python question: I can't speak specifically to what GAT is doing, but generally, pure python is slow, maybe a little slower than optimized Excel VBA. But Python can utilize libraries that make it extremely fast. The code has to be written in a way to utilized this speed.

    In sum, python can be really fast; or really slow. It depends. A lot of things are quicker and easier to program in Python vs. Excel VBA.

    Generally, I'd say you'll benefit in the long run to learn and switch to Python.
     
    #2930     Oct 17, 2021
    jtrader33 and d08 like this.