Hi, I need help with the CancelOrder command. I have been reviewing the documentation in the ninja help but the sample code that is indicated cannot compile. Could you indicate some other example to take the logic and implement it in my code? Thank you
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
Cancel Order Help
Collapse
X
-
Cancel Order Help
Hi, I need help with the CancelOrder command. I have been reviewing the documentation in the ninja help but the sample code that is indicated cannot compile. Could you indicate some other example to take the logic and implement it in my code? Thank youTags: None
-
Hello manueldecastro,
Thank you for your post.
Please review the SampleCancelOrder example script in the help guide link below that demonstrates how the CancelOrder() method is used to cancel orders.
SampleCancelOrder - https://ninjatrader.com/support/help...thod_to_ca.htm
Let us know if we may assist further.Brandon H.NinjaTrader Customer Service
- Likes 1
-
Hi, I have managed to implement the cancelOrder with the example they indicate but I have a problem. It works perfect for longs, but for shorts the order is canceled on the next candle, not respecting what it does for longs. I have tried putting the same input name for long and short and with different names but I can't, could you help me? thanks
Comment
-
Hello manueldecastro,
Thank you for your note.
To understand why the script is behaving as it is, such as placing orders or not placing orders when expected, it is necessary to add prints to the script that print the values used for the logic of the script to understand how the script is evaluating.
In the strategy add prints (outside of any conditions) that print the values of every variable used in every condition that places an order along with the time of that bar.
The output from prints will appear in the NinjaScript Output window. NinjaTrader 8: New -> NinjaScript Output
The prints should include the time of the bar and should print all values from all variables and all hard coded values in all conditions that must evaluate as true for this action to be triggered. It is very helpful to include labels and operators in the print to understand what is being compared in the condition sets.
Below I am providing a link to videos that demonstrate adding prints to a script to get further information about the behavior of the script.
NT8 — https://youtu.be/H7aDpWoWUQs?t=2577&...We0Nf&index=14
It is also helpful to enable TraceOrders.TraceOrders can be used in the strategy (set in State.SetDefaults) so it prints its order feedback, and you may also observe the log tab of the Control Center for additional information.
TraceOrders - https://ninjatrader.com/support/help...raceorders.htm
I'm also including a link to a forum post with further suggestions on debugging a script.
https://ninjatrader.com/support/foru...956#post671956
Please let us know if you have further questions.Brandon H.NinjaTrader Customer Service
Comment
-
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by kaywai, 09-01-2023, 08:44 PM
|
5 responses
602 views
0 likes
|
Last Post Today, 12:32 AM | ||
Started by xiinteractive, 04-09-2024, 08:08 AM
|
6 responses
22 views
0 likes
|
Last Post Today, 12:31 AM | ||
Started by Pattontje, Yesterday, 02:10 PM
|
2 responses
20 views
0 likes
|
Last Post
by Pattontje
Yesterday, 11:49 PM
|
||
Started by flybuzz, 04-21-2024, 04:07 PM
|
17 responses
230 views
0 likes
|
Last Post
by TradingLoss
Yesterday, 11:45 PM
|
||
Started by agclub, 04-21-2024, 08:57 PM
|
3 responses
17 views
0 likes
|
Last Post
by TradingLoss
Yesterday, 11:42 PM
|
Comment