I have a strategy that I am testing only in SIM at this point. The strategy file has an initial add and adds a stop. Let's talk longs only for the sake of simplicity.
When I get my signal, I use a market order to enter. I then add a sell stop market 10 to 40 points lower. I also add five buy stop market add-ons. These stops' prices are correctly calculated. (I know this because they normally work.) The buy stop add-ons are evenly spaced from the entrance price, AND have the same quantity as the initial trade. They are at a minimum 20 points apart up to 100 points apart.
If the market moves up in my favor, the add-on stop entrances are hit. As the add-ons are hit, I update the price of my sell stop order to be equal to Position.AveragePrice. I also update quantity but that causes no issues.
I am testing in the CME NQ future which is a relatively fast moving future.
As you can see from the above numbers. the initial stop is no closer than 10 points from the top of book. And when I get an add-on, the market is no closer than 10 points away.
Eventually, I ALWAYS end up with a stop reject. Few times a day. Sometimes the reject is on the initial stop add, and sometimes it occurs when I update the stop price after the first add-on. (I know this because I tag my orders and I can see the rejected orders' tags in your log which by the way is super helpful.)
The reject reads:
"Sell stop or sell stop limit orders can't be placed above the market, affected order: Sell 1 StopMarket @ 14425.25"
Sometimes they are buys and sometimes they are sells. Of course, the price changes with each reject.
----------------------------------------------------------------------------------
I don't think this reject is caused by latency because I have the software running on a private server in Chicago. My current thought is that the code check in NT8 to see whether my sell (or buy) stop order's stop price is above (or below) the market is using the live data feed and not the delayed data feed. (Sometimes when I log messages into Ninja Script Output window, I see that the current time for certain events (in SIM) is not delayed 10 minutes. While other events are delayed 10 minutes. So I know some parts of NT8 SIM code are not using delayed feeds.)
Can you offer any insight into this?
Thank you!
-Tim

Comment