Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy: All but first order fail

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

    Strategy: All but first order fail

    I can't figure this one out. I wrote a Managed strategy script by which I can enter orders either as StopMarket or MIT. They are not executed immediately because I place them away from price. But only the first order succeeds.

    Steps:
    1) I enable the strategy and enter an order via the strategy. It appears on ChartTrader and can be moved, it will execute when touched, and it can be canceled.
    2) I cancel the order. It goes away.
    3) I enter another order via the strategy. It's creation by EnterLongStopMarket(), etc, fails. The method return a null order. No order appears on the chart.
    4) Subsequent attempts all fail.
    5) I disable and enable the strategy. Again the first order succeeds and all subsequent orders fail, until I disable and enable it again.

    The parameters are the same each time, Only the price varies.

    Any ideas? Can I get more information from the system about why an order failed?




    #2
    Hello gbourque,

    Thank you for your post.

    I suggest checking the Log tab of the Control Center for any error messages that could be related to the orders not being submitted when expected. You may also set TraceOrders to true in State.SetDefaults to get helpful output to the NinjaScript Output window regarding orders when they are submitted, ignored, changed, canceled, etc:


    Prints may also be helpful diagnostic tools to help you debug your script. Here is more information about using prints as a debugging tool:


    Please let us know if we may be of further assistance.

    Comment


      #3
      The TraceOrders definitely helped. It told me the problem was EntryHandling should be set to EntryHandling.UniqueEntries.

      That fixed the problem. Many thanks!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      89 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      135 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      68 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      119 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      69 views
      0 likes
      Last Post PaulMohn  
      Working...
      X