Home > Technical Topics > Order Execution > Fast market Lesson: Stops can get rejected

Fast market Lesson: Stops can get rejected

  1. So my trading platform/system was trading for the first time in a fast market today (I shut it down for the last couple of days, out of fear). Market taught me a lesson, and exposed a flaw in my execution logic: The market will reject stop orders if the market is already below the stop price, leaving a position un-hedged. I should have known this.... but I didn't, and almost got bit. Fortunately, I was paying attention and was able to manually step in quickly and turned a 80 tick loss into a 20 tick gain (via luck, not skill).

    Moral of the story.... be careful out there, especially when you're auto-trading and your system is walking into unfamiliar territory.
     
  2. ok maybe I'm missing something.....
     
  3. What do you mean? I entered a bracket order, got filled on opening leg, but the the market blew through where my stop would have been before it hit the exchange. I assumed I would just get a market order in this situation, but rithmic or cme rejected the stop
     
  4. you would get the market fill if you had a standing order in place.
     
  5. Not necessarily. A fast market can jump a stoploss order. Even a stop loss needs a counter party to trade with. If everyone is running for the hills and price has moved far from your stop it may never fill.
     
  6. I think the stop rests on rithmics servers, until the open is filled. If the burst that filled the open took the market down through where the stop is supposed to be(which is what I believe happened), the stop never would get a chance to rest on the exg. Can't rest the stop prior to the open getting filled.
     
  7. I hear you... I had a stop that blew straight thru my limit and executed at a much lower price to exit my long on NQ trade yesterday... UGLY!

    but this is the very first time it has happened in over a year that I can recall... it is rare and I still firmly believe in stops on every trade
     
  8. I meant in general..the OP's order essentially was never placed since the market had moved past the limit level.
     
  9. a stop or a stop limit order ?
     
  10. Correct, and I got a reject message to inform me of such....but, like a fool, I didn't plan for this situation and was left unhedged for a bit.
     
  11. I so agree. Stops on every trade. So it was automated trading but you were watching it when it happened?
     
  12. Yup, it was automated, and I was watching fortunately. I only run when watching. I would have been okay if I wasn't, as my target would have eventually been hit...but my stop was supposed to be 2 ticks...and I went as low as 80, within seconds.

    Completely my fault, but I learned something today and for that I'm grateful
     
  13. Stop/market.... so it converts to a market order when touched... USUALLY it is the same price, but not always like yesterday.... honestly had I paid enough attention to the price action I would have stood on the sidelines... the NQ was putting in 60+ pt moves on 5 minutes bars... normally it is about 10-15 or so....
     

  14. After getting burned on an emergency fed rate cut many moons ago, I will only trade ES with a stop market. Yes you may get slippage in a fast market but it's never been very much if you are trading 100 lot or less
     
  15. I am glad you were watching and that it worked out.
     
  16. To be clear, I attempted to place a stop market, not stop limit. Issue was the trigger price was below the market at the time it hit the exchange (within ms of open fill). Not sure if this was a Rithmic reject, or a cme rejected...but I'll find out.
     
  17. What is your trading platform?
     
  18. that's rubbish, the fill might be unpleasant though.
     
  19. 100% custom combination of c++ and python. I use Rithmic API for data and execution.
     
  20. Ahh, so probably not graphically intensive, and assuming you have millisecond interface resolution, I guess it was just a quirk in the speed of the markets that day (been intense) and maybe coupled with a delay in your internet latency.
     
  21. Yeah, just quirk/oversight on my part. Googling around, other people have had similar issues with ninja trader.

    I'll look at my timestamps more thoroughly later, and post here
     
  22. You mean a stop limit order or a regular stop order at the market?
    A stop limit or a stop at market?
     
  23. As previously stated: stop market
     
  24. Okay, just checking. Thanks for sharing the info.
     
  25. If you want to sell something, there must be buyer.

    unfortunately during such market, there are lots of sellers and very few buyers.
    if you set a typical stop order, your position will be closed at terrible slippage.
    if you set a stop limit order, your position will most likely not be closed.

    it is not trading platform related.
     
  26. Timestamps below are in seconds since beginning of epoch (local machine time..my latency to rithmic appears to be about 30ms... I'm in Arizona):

    OMS Traffic:

    1517933323.066: Bracketed Limit Buy to Open order send at price $6480.00 (target and stop rest on Rithmic)
    1517933323.137: Limit Buy to Open Acknowledged (Exg Timestamp: 1517933323.110)
    1517933350.981: Limit Buy to Open Fill Message (1517933350.953)
    1517933350.984: Limit Sell (target $6481.25) Ack'd (1517933350.956)
    1517933350.984: Stop Sell (trigger $6479.50) Rejd (message text: Sell order stop price must be below last trade price ) (1517933350.956)


    Trade Data Traffic (red COULD be my opening fill) :

    Payload structure: [Instrument TradeSize TradePrice RithmicSboe RithmicUsecs ExgSsboe ExgUsec]

    LocalSsboe,Payload
    1517933350.034,"NQH8 1 6480 1517933350 8800 1 1517933350 8326"
    1517933350.048,"NQH8 1 6480.5 1517933350 23211 1 1517933350 22991"
    1517933350.983,"NQH8 1 6480 1517933350 952640 1 1517933350 952360"
    1517933351.0,"NQH8 1 6480 1517933350 953472 1 1517933350 953085"
    1517933351.0,"NQH8 1 6480 1517933350 953472 1 1517933350 953085"
    1517933351.0,"NQH8 1 6480 1517933350 953472 1 1517933350 953085"

    1517933351.009,"NQH8 1 6480 1517933350 953718 1 1517933350 953297"
    1517933351.009,"NQH8 1 6480 1517933350 953718 1 1517933350 953297"
    1517933351.012,"NQH8 4 6480 1517933350 953905 1 1517933350 953461"
    1517933351.012,"NQH8 5 6480 1517933350 953905 1 1517933350 953461"
    1517933351.013,"NQH8 1 6480 1517933350 953905 1 1517933350 953461"

    1517933351.017,"NQH8 5 6479.75 1517933350 954682 1 1517933350 954097"
    1517933351.017,"NQH8 1 6479.75 1517933350 954682 1 1517933350 954097"
    1517933351.017,"NQH8 1 6479.75 1517933350 954699 1 1517933350 954097"
    1517933351.017,"NQH8 1 6479.25 1517933350 954699 1 1517933350 954097"
    ---My Bracket Legs hit the exchange in this time window...after market has traded below stop--

    1517933351.038,"NQH8 3 6479 1517933350 981468 1 1517933350 981184"
    1517933351.038,"NQH8 1 6479 1517933350 981489 1 1517933350 981184"
    1517933351.038,"NQH8 1 6479 1517933350 981489 1 1517933350 981184"
    1517933351.042,"NQH8 1 6478.75 1517933350 984482 1 1517933350 984222"
    1517933351.042,"NQH8 1 6478.75 1517933350 984482 1 1517933350 984222"
    1517933351.042,"NQH8 1 6478.75 1517933350 984482 1 1517933350 984222"
    1517933351.042,"NQH8 1 6478.75 1517933350 984482 1 1517933350 984222"
    1517933351.119,"NQH8 1 6478.75 1517933351 4646 1 1517933351 4443"
    1517933351.135,"NQH8 1 6479.5 1517933351 6566 1 1517933351 6268"
    1517933351.366,"NQH8 1 6479.25 1517933351 341931 1 1517933351 341694"
    1517933351.388,"NQH8 1 6479 1517933351 363937 1 1517933351 363706"
    1517933351.388,"NQH8 1 6479 1517933351 363937 1 1517933351 363706"
    1517933351.43,"NQH8 1 6478 1517933351 404434 1 1517933351 403956"
    1517933351.43,"NQH8 1 6478 1517933351 404443 1 1517933351 403956"
    1517933351.43,"NQH8 1 6478 1517933351 404443 1 1517933351 403956"
    1517933351.43,"NQH8 2 6477.75 1517933351 404443 1 1517933351 403956"
    1517933351.43,"NQH8 1 6477.5 1517933351 404443 1 1517933351 403956"
    1517933351.43,"NQH8 1 6477.5 1517933351 404443 1 1517933351 403956"
    1517933351.43,"NQH8 1 6477.25 1517933351 404443 1 1517933351 403956"
    1517933351.43,"NQH8 1 6477.25 1517933351 404443 1 1517933351 403956"
    1517933351.43,"NQH8 1 6477 1517933351 404443 1 1517933351 403956"
    1517933351.43,"NQH8 1 6477 1517933351 404443 1 1517933351 403956"
    1517933351.43,"NQH8 1 6477 1517933351 404443 1 1517933351 403956"
     
  27. Note that this was NOT slippage, as the stop order was rejected by the exchange. It wasnt necessarily a platform error either.... I'm the trader and the platform programmer... so either way, the fault is my own. I misunderstood how a stop order would be handled in a fast market.... but... I wont do that again.
     
  28. Algo nonsense. Sux, doesn't it.
     
  29. Nah, I'd prefer this to low vol. Just gotta recalibrate myself for the new normal
     
  30. My last attempt...again maybe I'm missing something....you attempted to put a stop in after the threshold had been passed. Ie: price at 50. You want to put a stop at 48. Oops , fast market price at 45. System rejects my 48 stop. Of course it will, price is at 45. There is nothing to stop, horse is out of the barn. I think you are missing the forest for the trees, if I understand your OP.
     
  31. You're misunderstanding. Do you know what a bracket order is?
     
  32. Yes. Same principle applies. The market was missed.
     
  33. Yes...this has all been discussed and acknowledged. My assumption was that since the market was below my stop trigger that it would have simply been treated as a market order...this proved to be false.
     
  34. There are stop-orders for futures:

    Stop Order Notes

    • The stop order's trigger price is validated differently depending on the market state.
    • During the Continuous market state, a Buy stop order must be > last trade price and a Sell stop order must be < last trade price. Absent a last trade price, the settlement price is used.
    • During the Pre-Open and No Cancel market states, a Buy stop order must be > settlement price and a Sell stop order must be < settlement price.

    2nd bullet is exactly my issue. I sent a bracket to Rithmic, my opening limit rested on the exchange and the legs of my bracket rested on rithmics servers until the open was filled. Once rithmic got confirmation of the fill, they sent my target and stop to the exchange. 1-2 milliseconds is all it took for me to miss. I didn't anticipate this being an issue, but I should have.
     
  35. Yeah, that's why I prefer to code these things (bracket, OCO, etc) myself. Want to rely on providers as little as possible(data and/or execution only). Lots of unexpected things happen during fast markets. This way if something happens, at least it will be my fault which is easier to digest . Definitely smart for you to have been watching ... I guess I won't be trading from the beach anytime soon.
     
  36. I used to handle the bracket fully on my machine with my software, but decided it was safer to rest thing on a larger entitites server (rithmics), as they are more robust to power/network outages than I am.
     
  37. Your stop is too tight, even for calm markets. You would have to time the market perfectly on every trade. What do you think the chances are of that happening?
    Probably not much more than .0077%. Which is the size of your stop compared to the price of the NQ.
     
  38. Likely bad code.
     
  39. This is a crazy strategy. I just saw your limit order. Any trading strategy needs to be aligned with the volatility of the financial instrument.
    Your strategy attempts to avoid risk, which will never work. There is no reward without risk.
    You must embrace risk, then go from there
     
  40. Yes valid point. I favor Colo but it gets expensive. Good post!
     
  41. Thats my goal, but I'm not in a place where I can justify the increased fixed-cost...Someday soon, hopefully.
     
  42. Code worked exactly as designed. But, bad design on my part to not handle this. I never expected a stop order that was sitting server side to be rejected. Stupid, but mistakes are part of every development process.
     
  43. This seems to be a broker issue. As far as I remember, IB will trigger it even if it is bound for immediate execution. Not a market issue.

    That's not how stops work. After triggering it's a market order and there's always a market to trade with, even if far away. If it's stoplimit in which case it can fly past the limit price but that's not what he was using.

    Edit: should be noted that this is for futures, my scenario is for equities which is different.
     
  44. Thanks for your reply.

    Couple of things:

    1) I'm using a a 100% custom/self-developed software stack, and its only recently been put online. Risk is intentionally kept low so I can find issues like this, and not pay a massive price for it. I only trade maybe an hour or so a day while I can sit and watch it do its thing. Trading isn't paying the bills for me (yet :) ).

    2) I'm in what I call "Software/Strategy Risk Reduction" phase. My intent is to trade as frequently as I can, learn as much as possible, and basically break even with minimal swings. After data fee's, that's essentially where I am. I'm not done, but I've accomplished what I've wanted to thus far (maybe not as quickly as I'd like...).

    3) 100% agree with you, gotta understand and seek risk to make money. Generally speaking, I disagree with the statement that a 2 tick stop is too tight to be profitable with. Obviously, I need to have a high win rate, but my test and real time data suggests that is possible. The wild card here is market volatility, which I don't account for in real time. This wasn't an oversight, just a risk I accepted to more quickly accomplish the goals I stated in bullet 2. I've always known I was "tuned" to a low vol market, but that will be addressed for my "production" strategy.

    Good conversation, guys. Personally, I hope vol stays high. Makes things much more interesting.
     
  45. I don't have a time to go through the entire thread but upon reading the first few posts this is my comment:

    Yes, the market can jump your stop price for a variety of reasons (fast markets, gaps etc).

    Whether your stop loss gets executed in those circumstances depends on the setting of your platform/broker, since it is resting on their servers, not the exchange.

    If you're using Rithmic trader to execute trades, read below:

    There is a separate settings option that needs to be checked off on the platform in order to have these stops executed in case price jumps through your S/L. I accidentally learned that on one of Rithmic's webinars and had that on ever since (I don't trade with them at the moment). I don't remember though if you have to have your platform on when the price jumps through in order for that to work or it works for all your stops (once the option is activated) because these setting will be saved together with your stop order on Rithmic server. The logic tells me it's the latter one, but since it's your money, it's best to check with them directly (Rithmic, not your broker). But the option is right there buried inside Rithmic trader. Why it's not "on" by the default, is beyond me but what do I know...

    Hope that helps.
     
  46. Right there there is a second flaw in your assumptions:

    Once your order (opening the trade) to buy (or sell) get's filled, only your T/P part of the bracket (limit order) will be placed on the exchange. Your S/L, if it is stop market order, can't be on the exchange, it is on Rithmic's server until price goes through it when it get's activated (or not) depending on the settings I described for you earlier.
     
  47. In Rithmic, go to Configure Brackets and check "on" the option to: "convert stops to market on reject".

    the webinar I was talking about:

    note: video is for trader pro but works the same for non-pro version.

    hope that helps,
    Greg
     
  48. So curious what did you decide to do in such case? If I understand correctly, the exchange rejected the order because trigger price was outside of the protection range. I don't think there is anything you (or vendor) can do about it. My system re-submits but if I get three rejects (configurable), the strategy is suspended and manual involvement is required from that point.
     
  49. Greg,

    Thank you! I'm using R|Api, not R-Trader, so I can't do that exactly, but will end up implementing something similar in my own software.
     
  50. For now, log as a defect, and fix later.

    In the short term, market on reject implemented locally. But, somehow... I'd like this logic sitting server side. RTrader's market on reject logic appears to be implemented locally, and that has a risk associated with it. Haven't put much thought into how I want to attack that problem. Might just be a risk of doing business.
     
  51. I'm too dumb to know exactly what are you talking about, but when you say that Rtrader's ... market on reject is implemented locally, do you mean their's servers or the local application on your computer? I think it is on their servers. Since all stops rest on their servers, doesn't R-Api cover or allow similar functionality?
     
  52. That functionality appears to be implement in the rtrader software the resides on your computer, not the server. Rtrader is presumably built on top of the same RAPI, and the API docs don't indicate such capabilities
     
  53. Sure. It sounds like you have a plan, so that is good. Here are a couple things maybe you haven't thought about:

    Use volatility based stops and profit targets. On a day where the market makes a 240 point swing, do you really want to be shooting for an average profit of a measly 1.25 points? Take a snapshot of volatility each day at the same time, then keep a running average of it. Then you will know on any given day whether volatility is above or below average, and can adjust your system accordingly. I use an 11 period average of the ATR on a 5-min chart. You can use whatever you think works for your system.

    It sounds like you are serious about making trading your business, so you better plan it like one. You better know what your transaction costs are going to be for your system. Let's say your commission is $2.00 per contract and your system as it stands somehow has a win/loss ratio of 50%, even with your super tight stops. So in 200 trades, you gain 125 points and you lose 50 points for a total profit of 75 points. According to my calculations that is a $1500 profit. The total commissions on 200 roundtrips (400 contracts) is $800, which is 53%! Are you comfortable giving away over 50% of your business profit to your broker? Of course these are all just projections, but the point is, plug all this stuff into a spreadsheet and estimate your transaction costs.

    Peace out.
     
  54. So what is your point? If his system is profitable (positive expectancy) then all the commissions are "cost of doing business". Should he keep trading it OR forget the profits and look for another system only because the overall costs are "uncomfortably" high % of the profits?
     
  55. Yes this is a market lesson, stops can be missed when price gaps past them.

    This can't be eliminated, so how to minimise the probability and the level of damage to the account?

    Go to long-term trading.

    This also reduces the total number of transactions, reducing total fees payable, and cuts screen-watching time to a fraction - in turn reducing the likelihood of impulsive trading, emotional pressure, over-focus on entries and over-trading.

    Am I biased against day-trading? Yes. I am entitled to be biased as I'm making money by long-term trading.
     
  56. You may be right, generally speaking, but in this case long term trader is actually at a disadvantage. Effectively, you are forced to day trade out of your position. The worst part is that even a regular market order (not stop) is not guaranteed to be filled in full. Even worse, the unfilled portion is not cancelled back but sits on the book. It may be good logic for 99.9% of cases, but will really hurt you that 0.01%. One of the advantages of automating your strategies is that it requires you to be paranoid about all kinds of unexpected events. Day trading a strategy is one of the best ways to TEST your code, even if it is going to generate excessive commissions.
     
  57. Copy on all, and thanks for the insights. Fees and commissions are absolutely part of optimization process, but aren't something I try to minimize (from buy/sell strategy standpoint, obviously I seek the cheapest fcm that matches my needs).

    In my "production" strategy, I optimize for a combination of variance and mean return (after fees). And I've found, so far, that I can best minimize variance by trading on shorter time frames.