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!
See more
See less

Partner 728x90

Collapse

Cancel Order Help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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 you

    #2
    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

    Comment


      #3

      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


        #4
        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


          #5

          Thank you, I will continue studying since I cannot cancel the short orders

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by RideMe, 04-07-2024, 04:54 PM
          5 responses
          28 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by f.saeidi, Today, 08:13 AM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by DavidHP, Today, 07:56 AM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_Erick  
          Started by kujista, Today, 06:23 AM
          3 responses
          10 views
          0 likes
          Last Post kujista
          by kujista
           
          Started by Mindset, Yesterday, 02:04 AM
          2 responses
          18 views
          0 likes
          Last Post NinjaTrader_RyanS  
          Working...
          X