Developing "Spartan"

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

  1. #41     Feb 4, 2019
  2. Do you mean has mt4 got economic calendar??
     
    #42     Feb 4, 2019
  3. Overnight

    Overnight

    Easiest way would be to send a group message to the active mods here...Baron, Magna and oraclewizard77.

    Just insert the link to the OP in your message, and the edited text. Don't make it a habit though, or they might spittle at you. :)
     
    #43     Feb 4, 2019
  4. But then again, one could easily see the progress compared to the previous status overview if it were a new journal entry. And it is more easily visible how many new "items to be done" have been added meanwhile. In my own log book (not available online) I noticed that such approach gave me much better visibility, instead of going back in the past and modifying those original posts. Even two years later is it sometimes helpful to see why a certain portion of the code has developed (i.e. got changed) over time the way it did.
     
    #44     Feb 5, 2019
    nooby_mcnoob likes this.
  5. Buying vs building

    It's something I've talked about in my journals before. In the past, I've tried to strike a balance by using open source components at a high level, which I learned has the same problems as using someon else's entire platform because the high level concepts are not your own.

    In any case, I ran into a bug with Qt Charts and before I went too much further into debugging, I used my previous experience with Qt where anything beyond core UI is likely to be buggy or incomplete and decided to take the advice from another poster to use Bokeh. I've used it before, but only in passing and it turns out to be a decent library. It isn't perfect, but due to the design of Spartan so far, it was easy to swap out Qt Charts w/ Bokeh, though figuring out how to run the Bokeh server in-process was a bit tricky.

    upload_2019-2-6_22-2-54.png

    The code for plotting the on-chart indicators looks like this:

    Code:
            for indicator in self._vm.indicators():
                if indicator.drawOnChart():
                       for name,values,colour in indicator.subindicators():
                           colName = f'{indicator.title()}-{name}-values'
                           if indicator.plotType() == indicators.PlotType.SCATTER:
                               pl = p.scatter('date',colName,fill_color=colour,line_color=colour,source=self._bokehSource)
                           elif indicator.plotType() == indicators.PlotType.LINE:
                               pl = p.line('date',colName,line_color=colour,source=self._bokehSource)
                           p.add_tools(HoverTool(renderers=[pl],tooltips=[('date','@display_date'),(name,'@{%s}{1.11111}' % colName)]))
    
    It's going to need to change when it gets painful.
     
    #45     Feb 6, 2019
    IAS_LLC likes this.
  6. Buy vs build

    I'm at the point now where I'm going to be working on adding backtesting capability but I thought I should try and work with the interface to see if I want to tweak things compared to the ForexTester model. No real outcome yet, but very nice to see the personal productivity benefits of my own interface. In the screenshot below, I do a couple of fake chart-based trades. The way the interface works is I press spacebar to progress through each day and make a decision "at the close" of the last candle. This is something I will have to figure out obviously, since I can't enter "at the close" necessarily, but I'm sure most of the time it'll be close enough.

    Next journal entry will probably talk about the backtesting approach.

    (Note: the charted indicators are just for testing, my custom indicator is not shown)

    upload_2019-2-7_11-45-24.png

    The code gets uglier, but still manageable

    Code:
            for indicator in self._vm.indicators():
                if indicator.drawOnChart():
                    for name,values,colour in indicator.subindicators():
                        colName = f'{indicator.title()}-{name}-values'
                        if indicator.plotType() == indicators.PlotType.SCATTER:
                            pl = p.scatter('date',colName,fill_color=colour,line_color=colour,source=self._bokehSource)
                        elif indicator.plotType() == indicators.PlotType.LINE:
                            pl = p.line('date',colName,line_color=colour,source=self._bokehSource)
                        p.add_tools(HoverTool(renderers=[pl],tooltips=[('date','@display_date'),(name,'@{%s}{1.11111}' % colName)]))
                else:
                    indplot = figure(x_range=p.x_range,sizing_mode="scale_width",
                                     x_axis_type="datetime",
                                     title=indicator.title(),
                                     y_range=indicator.range(),
                                     toolbar_location=None)
                    indplot.title.align = bokeh.core.enums.TextAlign.right
                    plots.append(indplot)
                    for name,values,colour in indicator.subindicators():
                        colName = f'{indicator.title()}-{name}-values'
                        if indicator.plotType() == indicators.PlotType.SCATTER:
                            pl = indplot.scatter('date',colName,fill_color=colour,line_color=colour,source=self._bokehSource)
                        elif indicator.plotType() == indicators.PlotType.LINE:
                            pl = indplot.line('date',colName,line_color=colour,source=self._bokehSource)
                        indplot.add_tools(HoverTool(renderers=[pl],tooltips=[('date','@display_date'),(name,'@{%s}{1.11111}' % colName)]))
    
     
    #46     Feb 7, 2019
  7. Snuskpelle

    Snuskpelle

    I basically have the same opinion; finding alpha ("an edge") is the truly difficult part (unless doing latency sensitive stuff).

    Then again, if you know you will commit years of your life to your codebase, then YMMV.
     
    #47     Feb 7, 2019
  8. This is exactly it. I know that people are balking at it, but I'm already more productive with this than I would be with ForexTester/IB/MT4 in approximately the same amount of time.

    I can spend X amount of years getting familiar with interactive brokers, ninja trader, mt4/5 etc. But why? This is what I do, this is what I'm half-decent at, and every experience I have is that I am way more productive with my own code. A mistake I made last time I did this was that I depended too heavily on other people's concepts, since I used their code to put together something. I won't make that mistake this time. I will "design the machine" to make sure that I am using components that only do one thing and do them well. I will put together the components in a way that is better than the alternatives for me.

    In any case, if this was easy, and could be done in 3 months, then I would agree with you. But this is a multi-year undertaking, as my sorry presence on this website indicates :)

    PS: I already have a method for making consistent profits. Whether it is an alpha, I don't know.
     
    #48     Feb 7, 2019
  9. Backtesting

    Since I want backtesting to match forward testing to match live trading, this means I want all my reporting to be independent of whether I'm backtesting or live trading.

    Data-wise, it's pretty simple. I want to record trades that occur in an account. So I will start there. An account can be real, or backtested.

    In the end, I want to develop a tearsheet-like report for backtesting, forward testing, and live trading, not because I want investment, but for my own edification. Something like what these guys created here: https://www.quantconnect.com/blog/leans-tear-sheet-the-lean-report-creator/
     
    #49     Feb 7, 2019
  10. If you want to automate this you could run the review one minute before the end of the trading day. That gives you enough time to process data and get your order line filled. In most cases will the price in the last minute not change that much that it will have a substantial influence on your trading results (my assumption).
     
    #50     Feb 8, 2019
    nooby_mcnoob likes this.