I'm really stuck with a weird issue I can't explain.
I built a strategy based on the samples I found on this forum to bracket the market and tried to enhance it with trailing stops.
It works fine in most cases, but I found a case that literally is driving me nuts.
In most cases, the strategy works correctly, as shown below:
But in this one case, the trailing stop works correctly up to a point, and then it suddenly reverts back to its initial price, when the order was first submitted.
It looks something like that:
The crazy thing is that, as can be seen on the chart above, the market price is never returning to that low level, but somehow my stopLoss is reverting to its initial value.
I ran that case through the VS Debugger and just couldn't understand what happened. It all looks good until all of a sudden, my stopLoss goes out of whack.
I tried to figure this out until my eyes hurt, but still no luck.
I attached the NT8 logs that show all the orders and executions, it clearly shows the stopLoss executed at that crazy price, but it doesn't explain why that happened.
I also attached my strategy in the .cs file.
The test case to reproduce the issue is as follow:
- Replay the market data for the GC 02-20 contract as of Friday Jan 10th 2020
- Launch the strategy at 8.29:58 am (yes, it has to be this precise)
- By 8.30:02 am, the problem from the screenshot above should be apparent
I spent so much time on the debugger I have no more idea how to tackle this.
Really appreciate is someone has some pointers to help me!
Comment