Developing "Spartan"

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

  1. That means that my position size should be such that if my stop loss is hit, that I lose 5%. So on a $100K account, the position size should be adjusted so that the max loss is $5000. This means the position size is primarily dependent on the volatility of the pair.

    Does that make sense? What do you think about that plan?
     
    #81     Feb 15, 2019
  2. Software consulting is also a declining industry, by the way, primarily because people just don't think someone should be paid more than the CEO.
     
    #82     Feb 15, 2019
  3. Yes, that makes a lot of sense. You mentioned that your stoploss level is volatility adjusted, so the position size is implicitly also volatility adjusted.
    I use volatility adjusted position sizing and believe that it is better as a risk management tool than fixed position sizing.
     
    #83     Feb 15, 2019
    nooby_mcnoob likes this.
  4. Same. The market doesn't care about your position size, so you should adjust it to the market.
     
    #84     Feb 15, 2019
  5. Well nooby. Good luck with your little project here. Taking a furlough from ET for a while. Maybe I’ll start up a gambling journal later this year. Peace out.
     
    #85     Feb 16, 2019
    nooby_mcnoob likes this.
  6. Tweaking

    The majority of the back/forward testing is working well, although the forward testing is still using a sim (read: not paper) account. My risk management has also been implemented which makes me happy. It's mindless, formulaic and I literally cannot adjust it on the fly. The results so far are good and match my previous backtests, but this is ballparking it. There are no reports yet. I will try to use pyfolio, though my experience with it is that it is very fragile.

    For the next few days, I'm going to tweak things UX-wise, make sure I'm happy with things and have the information I need at my fingertips.

    I'm still missing Forex volume data, I plan to research that this week as well. I'll have to recreate it through tick data from IB but that's not a big deal.

    Also on the list will be hooking up the order execution to Interactive Brokers. This is where the design of things may or may not work out well but fortunately, things are loosely coupled enough that any redesign should be limited to just that area. It was fun to implement simulated order execution on the sim broker but I was unable to get a nice mathematical approach, just brute forced it. By mathematical, I mean I know that sell and buy stops can be treated inversely and have the same logic applied, but since it isn't crucial, I just have a bunch of:

    Code:
                    if order.action == OrderAction.BUY:
                        order.limitPrice = min(bar.close + order.trailAmount,order.limitPrice)
                    else:
                        order.limitPrice = max(bar.close - order.trailAmount,order.limitPrice)
    
    All over the place.
     
    #86     Feb 20, 2019
  7. d08

    d08

    Well said.
    Let's not forget MetaTrader is closed source, so when they decide not to update the software, you're out of luck, it will over time become useless. Your own will work indefinitely when updated.

    There are good reasons why banks and funds use their own software mostly, not something off the shelf. Being tied to some Russian made software which posts things to a cloud (that you might not be aware of) is a bad idea when algos are concerned.
     
    #87     Feb 20, 2019
    nooby_mcnoob likes this.
  8. Here is the code that implements the somewhat automated trade management. The things I like about this is that it reads pretty much how I would describe it in English. Or maybe just because I'm used to code, it reads like that to me. The other thing I like about it is that it is my organic API. I control this 100%.

    I've pixelated stuff for no reason, just to annoy people :)

    Things that will need to change later are that this trade management strategy is global and applies generically to everything I will trade. If I end up trading more than just forex with this, then I would probably want to localize the trade management strategy.

    Secondly, I need to implement that TODO post-haste because otherwise the risk being put on depends on the number of trades I've got ongoing which is not desirable.

    upload_2019-2-21_7-56-24.png
     
    #88     Feb 21, 2019
    Stockolio likes this.
  9. Will this code be constantly monitoring the open orders and your positions? Or will it be run on demand, e.g. once per minute?
     
    #89     Feb 21, 2019
  10. Good question, it runs on demand when orders are updated. This could be problematic if (for example) the app crashes and some take profit is hit but that's not a big deal. Once things are back up, the orders will be updated. I haven't implemented that yet though.
     
    #90     Feb 21, 2019