Developing "Spartan"

Discussion in 'Journals' started by nooby_mcnoob, Feb 3, 2019.

  1. The purpose of this journal is to catalog development of my own platform to implement a forex trend-following strategy which I am calling Spartan. The reasons I am writing my own:

    1. I don't want to spend time learning another platform's quirks. I'd rather understand my own 100%

    2. I want to back test, forward test and trade live with the same interface. I am probably somewhat autistic and can't deal with changing interfaces to trade to the point of paralysis. In the past, I've done this using a frankenstein of open source components which were lacking in some way.

    Further, I have manually tested a strategy using ForexTester which I want to live trade but live trading with ForexTester is not possible. At the moment, I am forcing myself to forward test with Interactive Brokers. If it works out I may just stop doing this. Main problem is that I cannot add custom indicators to IB, as far as I know.

    3. I don't want to write custom indicators in non-core languages and spend time learning their quirks.

    Each week/sprint/cycle I plan to pick the next most helpful thing that would get me to successfully backtest in a similar way to ForexTester. I expect the bulk of the software will take 4-6 weeks to finish, which probably means 8-12 weeks.

    The plan is something like this:

    * Data storage/download (done)
    * Rough-in charting (done)
    * Rough-in custom indicators
    * Basic backtesting console
    * Connect backtester with charting
    * Backtest report
    * Do full backtest
    * Do forward test
    * Connect executions to IB
    * Switch to paper account
    * Switch to live trading

    The strategy

    Basic trend following strategy on daily charts. Main observation is that there are 8000 different currencies. Previous attempts were designed to win with one currency, but after running backtests from another strategy with a basket of currencies, the results were much smoother than running with one.

    The software

    Python-based, built using Qt and SQLite for storage. Nothing exceptional here.

    Here's the interface so far:

    upload_2019-2-3_10-23-57.png
     
    sef88 and TZT like this.
  2. Custom indicators

    As I'm not trying to make something that's generally useful, the only thing that my design for custom indicators needs to do is taken in a series of OHLC bars and spit out a single value.

    The first indicator will a volatility indicator, probably the average true range.

    The main thing that needs to be made easy is:

    1. Creating new custom indicators
    2. Adding them to the current chart
    3. Configuring their parameters

    I could potentially do this by creating fancy new interfaces, etc but really all I need is the ability to do something like this:

    Code:
    chart.indicators["ATR-14"] = indicators.ATR(window=14,color=Qt.yellow)
    # .. later on when I'm done with it ..
    del chart.indicators["ATR-14"]
    
    The only thing I don't really understand how to do well is calculating the values. Should I cache them, should I redraw the entire chart? In the spirit of doing the dumbest thing that still works, I will just calculate the ATR at each point in the main chart.

    I suppose the first step to doing this is to add some form of a Python console to the application. Is there a way to embed a Python console into a PyQt app? Sure is... Jupyter notebooks InteractiveConsole!

    This also solves another problem I would eventually have which is "how do I store the unique configuration of my charts". Just load the Jupyter notebook and execute. Done.

    To get this done by next week, I would need to implement:

    • Add interactive console
    • A custom indicators API
    • Charting of custom indicators

    Seems doable.
     
    Last edited: Feb 3, 2019
    d08 likes this.
  3. destriero

    destriero

    Hedge fund to retail FX. Spartan. Sure.
     
  4. I'm not sure I follow.
     
  5. Good Luck!
     
    nooby_mcnoob likes this.
  6. Oh I see, you are being sarcastic. It's not like I have bona fides like some of the other people on here. I've been writing software to price derivatives for a long time and had I not left the hedge fund, I expect I would have been successful there and maybe made a home in the industry. Unfortunately, I did not and so I have to do the rest on my own.

    I have a 4 year horizon to succeed in trading now that the chaos in my personal life has been settled to a large degree. I've already started making 5-6x in consulting income as a result - more than ever, and more than I would have made at the hedge fund by some > 1 (integer) factor. Hopefully the clarity of mind I now enjoy can help me succeed here as well.

    But if the past is any indication, I expect some sort of blow up in the next six months. Fun story: as soon as my divorce was finalized for the 43rd time, the government came after me. Fortunately, they have to play by the rules and we've already talked them down from high six figures to mid 5 figures.
     
  7. destriero

    destriero

    I don't get it. You state that you worked for a legit fund yet you're piddling around with forex. A market that is legitimately 80% noise. Why not attempt to establish an edge in a market that is exploitable (equities)?
     
    Nobert, dealmaker, qlai and 1 other person like this.
  8. Accountants work for hedge funds too, doesn't give them an edge.
     
  9. And I may or may not have information gleaned from my time at the fund that leads me to think that forex is not noise.
     
    lovethetrade and Onra like this.
  10. IAS_LLC

    IAS_LLC

    Good luck, sir. 1 recommendation....don't tie yourself to QT. I made that mistake on my first iteration of a trading platform. I really like Qt, but I strongly recommend you use something browser based (bokeh) if you have any desire to host your software in a data center and monitor it remotely.
     
    #10     Feb 3, 2019
    nooby_mcnoob likes this.