Upon testing my code in playback mode, I get error:
Buy stop or buy stop limit orders can't be placed below the market.
Strategy submitted an order that generated the following error: "Order rejected" Strategy has sent cancel request, attempted to close the position and terminated itself.
My code is:
if (state == state.configure) {
SetProfitTarget(6 ticks)
SetStopLoss(6 ticks)
}
OnBarUpdate{
...if (condition1) EnterLong();
if (condition2) EnterShort();
}
This leads to a couple of questions:
1) Searching the forum, I see this question keep on coming up - and the answer is not consistent. Sometimes they ask to send log files of the environment. Other times they ask to change the environment. Why is this?
2) As I understand the issue, this is caused when the current price moves so much just after the order is requested, either the profit target or stop loss becomes out of range. I'm using a 6 tick spread most of the time, so I find it difficult that as soon as I submit EnterLong or EnterShort, the market suddenly moves 6 ticks in one direction or the other, that my profit target or stop loss is now out of range - all within microseconds. I suspect something else is up? Can you explain?
3) Is there any way this error can be captured, instead of terminating the program? It's irritating when I set up a large run on Playback, and then near the end, the strategy craps out on this error. Really, when this condition occurs, why can't NT simply cancel the order? This seems like something for a future enhancement request.
As always, thanks for your help,
Comment