Portfolio level stop loss in Interactive Brokers

Discussion in 'Trading Software' started by newdog, Oct 6, 2015.

  1. newdog

    newdog

    I was going through the stop loss in Interactive Brokers and seems only stop loss available is for individual positions.

    Is there a way I can do the portfolio level stop loss i.e. if all assets of my portfolio net to a certain percent below a threshold do a portfolio liquidation.

    Or if someone has coded that in Excel and is willing to share their code that would be much appreciated.
     
  2. ktm

    ktm

    Not sure how long you've been with IB, but I would investigate this thoroughly before you decide to implement such a thing.

    There are times when the market is thin, or fast, or after hours - or a host of other conditions - and IB's "Net Liquidating Value" number is wildly off. It's not every day, or even every week but it happens sometimes. It's usually just for a few minutes and corrects itself once the offending instrument posts a quote or some other anomaly corrects itself.

    Again, I'm not sure of your specific situation but this kinda thing should be part of your evaluation.
     
  3. There are some very reliable techniques using options to protect whole portfolios.
     
  4. I don't know why somebody would want to liquidate your whole portfolio all at once, that seems like a way to be set up for failure. Instead I think it would be better to gradually cut out the dead wood in a portfolio over time.

    If your on the investment basis just look at a weekly bar chart (each bar is what happened in a week), and set you stop losses for each individual security there.

    - Andrew
     
  5. I have looked for something very similar some time ago for some of my sub accounts. In the end I coded up an algorithm myself using IB'S Api. It is fairly simple and you can effect do it in Excel as well though I do not have VBA code or the like to hand out. But it does make sense in niche cases. For example a currency basket would lend itself well to such idea as the assets in question are priced round the clock and are fairly liquid. But as someone else pointed out I would also build in certain risk algorithms to prevent bad quotes from liquidating your whole portfolio.I defined a threshold deviation from the previous price as valid and reject prices outside such band.

     
    Last edited: Oct 6, 2015
  6. Account stop loss = bad idea

    Think of may 6th 2010 flash crash and aug 21 of this year. Todays algo driven environment is more likely to create these flash crashes, and probably more of these mini flash crashes will occur in the future especially in etfs and stocks. Even liquid futures are susceptible to these super quick drops. One really bad fill could trigger the account stop loss at a time when liquidity is thin.

    If you need to do it make sure its a custom stop loss set for each position but use an average of multiple fills across many minutes before triggering a SL.
     
  7. Uh? Makes no sense. So you are saying one bad fill is worse than exposing the entire portfolio to potentially devastating losses? You may not understand the question OP asked fully:

    If aggregate pnl on a portfolio falls below a threshold then a portfolio liquidation is sought. That does not mean the entire portfolio will be executed at bad prices as each individual position will be closed even if only one asset is exhibiting a large adverse move. Due to portfolio diversification it is entirely possible that only one position is closed at a large loss but all others at a profit yet the aggregate pnl simply dipped below a certain threshold. Not acting exposes you to much higher risks.