Developing a Trading Framework from Scratch

Discussion in 'Automated Trading' started by fatrat, Nov 29, 2006.

  1. fatrat

    fatrat

    Tested the system on a few products and the results are decent, but there's still a lot of work to be done. Unfortunately, the past week was filled with personal stuff.

    I wanted to post more results, but haven't had time to actually document my work. The problem I'm facing right now is divising an exit strategy for the opening order module.

    Another issue that pops up is whether I should use market orders to exit, or whether I should use limit orders. If limit orders aren't hitting, then I have to ask how I want to get rid of a position. Do I want to cancel and chase down something, etc ?

    Anyone care to comment on how their automated exits work? Market out? Chasing seems dangerous and more difficult to program and test. Entry can be precise, but does the exit need to be as precise?
     
    #41     Dec 11, 2006
  2. fatrat

    fatrat

    I eyeballed an opening order trade based on my OO signal generation tool and picked ADBE because of the upgrade this morning. It made me about $70, but my exit was poor. I used the tried and true sort of gap-closing behavior that can be exhibited when futures aren't running. I shorted ADBE on the morning reversal for the gap close but couldn't figure out how to exit that trade properly.

    I manually managed the trade and tested whether my code was able to keep the data flowing smoothly. I am somewhat concerned about managing positions and have decided to read some more books on position management and risk in automated systems. I'm still formalizing the backtest results from my system and building the E-Signal -> Trading Engine bridge over which the orders will run.

    I don't want to flood the e-mail inboxes of people subscribed to this thread, so I'll see if I can merge all my changes into one change list and start posting 5-day development summaries on the system.
     
    #42     Dec 11, 2006
  3. fatrat

    fatrat

    At 100 shares per position on one product I tried it out on. I used Don Bright's openings and then just used a slow stochastic reading for exit, because I still haven't come up with a competent way of exiting Don Bright's opening system using automated trading. I have some ideas and mathematical formulas, but they need implementing.

    The profit factor neglecting commissions and slippage is 1.74 on the product I used. I have so much work to do on this system it's almost overwhelming. But I guess I'm crazy and I like pain and misery and more programming and debugging. :) Almost want God to just fast forward me to the part where I'm rich and sitting in a room full of computers quietly humming along and managing my money.

    Total Trade Analysis

    All Trades / Long Trades / Short Trades
    Net Profit $94 / $75 / $19
    Gross Profit $229 / $130 / $99 /
    Gross Loss ($135) / ($55) / ($80)
    Adjusted Net Profit ($4.4) / $5.34 / ($50.5)
    Adjusted Gross Profit $156.58 / $76.93 / $49.5
    Adjusted Gross Loss ($160.98) / ($71.58) / ($100)
    Select Net Profit $29 / $40 / ($11)
    Select Gross Profit $164 / $95 / $69
    Select Gross Loss ($135) / ($55) / ($80)
    Account Size Required $60 / $35 / $45
    Return on Account 156.67% / 214.29% / 42.22%
    Avg Monthly Return $23.5 / $23.5 / $23.5
    Monthly Return StdDev $27.19 / $27.19 / $27.19
    Return on Initial Capital 0.09% / 0.07% / 0.02%
    Max Strategy Drawdown ($79) / ($58) / ($57)
    Max Strategy Drawdown (%) (0.08%) / (0.06%) / (0.06%)
    Max Close To Close Drawdown ($60) / ($35) / ($45)
    Max Close To Close Drawdown (%) (0.06%) / (0.03%) / (0.04%)
    Return on Max Str Drawdown 1.19 / 1.29 / 0.33
    Profit Factor 1.7 / 2.36 / 1.24
    Adjusted Profit Factor (0.97) / 1.07 / (0.49)
    Select Profit Factor 1.21 / 1.73 / (0.86)
    Max # Contracts Held 100 100 100
    Commission Paid $0 / $0 / $0
    OpenPosition P/L $0 / $0 / $0
    Annual Rate of Return 0.39% / 0.33% / 0.08%
    Monthly Rate of Return 0.03% / 0.03% / 0.01%
    Buy & Hold Return ($23074.11) / ($20366.97) / ($23074.11)
     
    #43     Dec 11, 2006
  4. fatrat

    fatrat

    I used a 5 cent stop loss on the strategy too. I don't know how intelligent this is, and I have to try a few different parameters.

    One problem I have with E-Signal is that I can't dynamically script the engine to run the backtests. I either need to write my own backtesting engine that provides me with the results they're giving, or manually run the tests.

    The plan of action for now is:

    - Correct and analyze exit strategy for OO system
    - Develop trading bridge to paper trading interface
    - Clean up order management interface

    Not going to see the light of day for a while until I accomplish these tasks. I fell behind on some of the code reviews of the old code, so the work really piled up. Just thinking about it makes me want to take a nap. I haven't drawn some of the UML diagrams I intended to draw as well. THERE JUST ISN'T ENOUGH TIME IN THE DAY!!! :confused: :mad:
     
    #44     Dec 11, 2006
  5. Tell me about it! Looks like you are making excellent progress nonetheless.
     
    #45     Dec 11, 2006
  6. You guys are doing exception work with your automated systems ... I see where I'm going to have to spend the next two years of my learning and studying.

    Regards,

    JJ
     
    #46     Dec 11, 2006
  7. fatrat

    fatrat

    I made a mistake this morning while trading that was due to a technical problem with my setup.

    E-Signal, when it runs out of GDI resources, occasionally will shorten a day or drop information. When my program was exporting futures data from the exchange into the database for all the other programs to use, the E-Signal EFS framework failed to iterate over all the bars because all the bars didn't exist. So the forecasted opening price was off by 30 cents. It seemed wrong to me, so I waited for a second or two, pulled all my opening orders, and then waited for what I thought was momentum and rode the morning move.

    I'm realizing how dangerous and unreliable E-Signal can be when there are resource problems, so I've decided to reboot my computer every morning at 6AM. I think I am going to convert some of my components into system services also.
     
    #47     Dec 12, 2006
  8. fatrat

    fatrat

    Ran the morning trading system with a manual execution and made $40 on 600 shares. So far, my system's made me $111 over three days of trading on blocks of 300 shares at a time.

    If it works this well when I automate it, I will be a very happy man.
     
    #48     Dec 13, 2006
  9. fatrat

    fatrat

    I ran the system with a new and improved reporting interface. This morning, I made $81 on 600 shares testing the system. It is still not automated because I've been dragging my feet on the position manager.

    I'm debating continuing this thread, because I found this book that seems to be pretty good:

    http://www.amazon.com/Building-Automated-Trading-Systems-Introduction/dp/0750682515

    I haven't purchased it, but I did browse through it. Seems as if a lot of good content is already there. I suspect I will move this thread to a personal blog as opposed to ET.
     
    #49     Dec 14, 2006
  10. That book looks great. Pity I'm going to have to wait till March to get it.
     
    #50     Dec 14, 2006