Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Market price not matching close[0]
Collapse
X
-
Market price not matching close[0]
My strategy moves ExitShortStopMarket (or Long depending on the trade) to new price once a PnL is achieved. Running on Playback, I occasionally receive the error: "Plauback101: Buy stop or buy stop limit orders can't be placed below the market." I expect the error is related to a gap in market price. I put a check in the code to return from OnBarUpdate (Calculate.OnPriceChange) if the price jumps by more than one tick. I still receive the error even though the chart shows that Close[0] is at right price compared to the buy or sell stop limit. I attached a screen capture from the chart window to explain more. Is there a way around this problem? -
Hello hgheith,
I would recommend adding a check that the price you are about to change the order to is below the ask (for a buy order).
if (myNewPrice < GetCurrentAsk())
{
myStop = ExitShortStopMarket(myNewPrice);
}
else
{
myStop = ExitShortStopMarket(GetCurrentAsk());
}
In a fast moving market, it is possible for the price to change before the order can be submitted. Placing further below the ask would help for the change order to be accepted.Chelsea B.NinjaTrader Customer Service
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by naanku, Today, 07:25 PM
|
0 responses
3 views
0 likes
|
Last Post
by naanku
Today, 07:25 PM
|
||
Started by milfocs, Today, 07:23 PM
|
0 responses
1 view
0 likes
|
Last Post
by milfocs
Today, 07:23 PM
|
||
Started by PaulMohn, Today, 06:59 PM
|
0 responses
6 views
0 likes
|
Last Post
by PaulMohn
Today, 06:59 PM
|
||
Started by bortz, 11-06-2023, 08:04 AM
|
48 responses
1,750 views
0 likes
|
Last Post
by carnitron
Today, 06:57 PM
|
||
Started by Jonker, 04-27-2024, 01:19 PM
|
3 responses
23 views
0 likes
|
Last Post Today, 05:45 PM |
Comment