Thanks.
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
my stop doesn't work
Collapse
X
-
Tags: None
-
Hello Parmenides48,
Enable TraceOrders in State.Configure and print the order object in OnOrderUpdate() to get more information about what is happening to orders.
https://ninjatrader.com/support/help...raceorders.htm
https://ninjatrader.com/support/help.../nt8/print.htm
https://ninjatrader.com/support/foru...121#post791121
I see that your ExitLongStopMarket() call does not have isLiveUntilCancelled set to true, so this order would be automatically cancelled when the submission bar closes unless the order is re-submitted.
https://ninjatrader.com/support/foru...374#post836374
Enable TraceOrders to see if orders are being automatically expired when the submission bar closes.Chelsea B.NinjaTrader Customer Service
-
Thanks for your answer,
but, sorry,
I can't see in my strategy script
how to code isLiveUntilCancelled set to true.
Comment
-
Hello Parmenides48,
Please review the forum post on isLiveUntilCancelled linked in post #2.
ExitShortStopMarket(1, true, 1, execution.Order.AverageFillPrice + 20*TickSize, string.Empty, string.Empty);
ExitLongStopMarket(int barsInProgressIndex, bool isLiveUntilCancelled, int quantity, double stopPrice, string signalName, string fromEntrySignal)
Chelsea B.NinjaTrader Customer Service
Comment
-
Ok, I understand that the only way to mantain the stop order is adding all this parameters,
because if I only use the stop order of my code, with only quantity and price parameters:
else if ( mp== MarketPosition.Long)
{ ep= Position.AveragePrice;
sp= ep-10*TickSize;
if( Close[0] > sp)
ExitLongStopMarket(1, sp);
else
ExitLong(1);
it will work only with the first bar, and won´t be re-submitted on the next bars.
Is like that?
Comment
-
I changed the stop order , with all this parameters,
and in my logic I resubmit the order with the same price on every bar, but the stop order is still not working.
The new codef or the stop order:
else if ( mp== MarketPosition.Long)
{ ep= Position.AveragePrice;
sp= ep-10*TickSize;
if( Close[0] > sp)
ExitLongStopMarket(0,true,1, sp, string.Empty, string.Empty );
else
ExitLong(1);
}
What is wrong ?
Comment
-
-
Hello Parmenides48,
Is TraceOrders set to true in State.Configure?
From the forum post linked in post #2 on using print and trace orders:
"For a strategy and orders specifically, the next step is to set TraceOrders = true; in Initialize() for NinjaTrader 7 or in State.Configure within OnStateChange() of NinjaTrader 8.
If TraceOrders is set to true in State.SetDefaults instead of State.Configure, the change will not take effect until a new instance of the script is added. Defaults are only pulled for new instances.
In the Strategy Builder TraceOrders is set in the Defaults (and requires removing and adding a new instance).
TraceOrders will print to the output window when orders are being submitted (so we can see if they are being submitted) and also provides information if orders are being ignored or cancelled.
TraceOrders NT7 - https://ninjatrader.com/support/help...raceorders.htm
TraceOrders NT8 - https://ninjatrader.com/support/help...raceorders.htm
Further, print the order object within OnOrderUpdate.
Print(order.ToString());
These will provide information about when orders are being submitted, and provide the updates of orders as they become accepted, working, filled/cancelled.
OnOrderUpdate() NT7 - https://ninjatrader.com/support/help...rderupdate.htm
OnOrderUpdate() NT8 - https://ninjatrader.com/support/help...rderupdate.htm"Chelsea B.NinjaTrader Customer Service
Comment
-
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by tkaboris, Today, 05:13 PM
|
0 responses
2 views
0 likes
|
Last Post
by tkaboris
Today, 05:13 PM
|
||
Started by GussJ, 03-04-2020, 03:11 PM
|
16 responses
3,281 views
0 likes
|
Last Post
by Leafcutter
Today, 04:14 PM
|
||
Started by WHICKED, Today, 12:45 PM
|
2 responses
19 views
0 likes
|
Last Post
by WHICKED
Today, 03:36 PM
|
||
Started by Tim-c, Today, 02:10 PM
|
1 response
10 views
0 likes
|
Last Post Today, 02:52 PM | ||
Started by Taddypole, Today, 02:47 PM
|
0 responses
5 views
0 likes
|
Last Post
by Taddypole
Today, 02:47 PM
|
Comment