2/18/2016 6:00:13 AM Ignored PlaceOrder() method at 2/18/2016 6:00:13 AM: Action=SellShort OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=34.12 SignalName=shortentry' FromEntrySignal='' Reason='Invalid order price, please see log tab'
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
ignored placeorder() method
Collapse
X
-
ignored placeorder() method
My strategy reverses at entershortstop and enterlongstop. After backtesting, my strategy took a long at 34.14. An exiting and reversing entershortstop at 34.12 wasn't placed and I can't tell why. It says invalid order price, but the order was to be below my long entry, which would be right. This is happening occasionally throughout my backtest. The log is saying things like the stop was greater than or equal to the close of the current bar. Ive been using a 1 tick range for the data series, with atleast 2 ticks distance for the reversing orders. Also, the days with log errors that an order was ignored, weren't necessarily the days an order was ignored under the trades tab in my strategy analyzer.
2/18/2016 6:00:13 AM Ignored PlaceOrder() method at 2/18/2016 6:00:13 AM: Action=SellShort OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=34.12 SignalName=shortentry' FromEntrySignal='' Reason='Invalid order price, please see log tab'Last edited by sampras010; 03-30-2016, 12:27 PM.Tags: None
-
Hello sampras010,
Thank you for your post.
May we review the strategy used that results in these message? Can you attach a screenshot of the settings used in the Strategy Analyzer as well as the instrument(s) used?
You can attach your strategy to your response by going to File > Utilities > Export NinjaScript > Export selected source files > select your strategy > select the right arrow > Export. The file will be located under (My) Documents\NinjaTrader 7\bin\Custom\ExportNinjaScript.
-
-
I am seeing this occur on the "longentry" in my testing. As I see it the execution occurs on the bar after the condition is true, so the "longentry" is placed based on the average price of the position plus two ticks which may be too close. And in your case on your side the "shortentry" may be too close as well.
You may wish to increase the distance from the average price of the position.
Comment
-
When I try it with the I orders equal to null like this
protected override void OnExecution(IExecution execution)
{
if( longorder == null && execution.Order != null && execution.Order.OrderState == OrderState.Filled && execution.Order.Name == "shortentry" && execution.Order.OrderAction == OrderAction.SellShort )
{
longorder = EnterLongStop(0, true, 1, (Position.AvgPrice + 2 * TickSize), "longentry");
}
the I orders stop submitting
Comment
-
now the backtest stops after the first trade with the same error message
**NT** Error on calling 'OnExecution' method for strategy 'experiment/d1e65a7719bc4432baa46f17d3d70ba6': Object reference not set to an instance of an object.
Comment
-
I also tried
if (execution.Order != shortorder && execution.Order.OrderState == OrderState.Filled)
{
shortorder = null;
}
The backtest completes one day and then the error message
Comment
-
Originally posted by sampras010 View PostI also tried
if (execution.Order != shortorder && execution.Order.OrderState == OrderState.Filled)
{
shortorder = null;
}
The backtest completes one day and then the error message
Can you provide your full script with the added check and setting the Order objects to null?
Comment
-
Originally posted by sampras010I'm trying to duplicate the ATM's reverse at stop function. So after the first short entry at 6, under onexection I'm waiting for that to get filled, then enter a reversing order 2 ticks above, if that gets filled then enter a reversing order 2 ticks below, it that gets filled then a reversing order 2 ticks above, so on and so forth until a profit threshold is reached then I want to cancel the remaining reversing order, and start again the next day. I would think the reversing orders would have to be under on execution because they would only be placed upon a fill. The final cancel order I feel could take place under onbarupdate, after the threshold condition has been met at the same time the final position is closed, but I haven't been able to get that to work. So I put the cancel order under onexecution under the condition that a sell or buy to cover takes place, since sell or buy to cover appear to have a unique identity in the log only after the profit threshold has been met and final position is closed. All in all the cancel order has been working under onexecution, the strategy is reversing as it should. It's just that in backtesting over a month, trades are only being placed several days or less.Attached Files
Comment
-
You would reset the gross loss as follows:
Code:if (Bars.FirstBarOfSession) { glossStart = priorprofitPerformance.AllTrades.TradesPerformance.GrossLoss; trades = 0; } if(Performance.AllTrades.Count > trades) { glossDay = priorprofitPerformance.AllTrades.TradesPerformance.GrossLoss - glossStart; }
To stop the strategy until a new day after a condition is met you would use a bool.
For example:
Code:if (mybool && mycondition) { //place trades } if (conditiontostop) { mybool = false; } if (Bars.FirstBarOfSession) { mybool = true; }
Comment
-
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by strategist007, Today, 07:51 PM
|
0 responses
2 views
0 likes
|
Last Post Today, 07:51 PM | ||
Started by StockTrader88, 03-06-2021, 08:58 AM
|
44 responses
3,969 views
3 likes
|
Last Post
by jhudas88
Today, 06:59 PM
|
||
Started by rbeckmann05, Today, 06:48 PM
|
0 responses
5 views
0 likes
|
Last Post
by rbeckmann05
Today, 06:48 PM
|
||
Started by rhyminkevin, Today, 04:58 PM
|
4 responses
58 views
0 likes
|
Last Post
by dp8282
Today, 06:13 PM
|
||
Started by iceman2018, Today, 05:07 PM
|
0 responses
6 views
0 likes
|
Last Post
by iceman2018
Today, 05:07 PM
|
Comment