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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      47 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      23 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      33 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      51 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      42 views
      0 likes
      Last Post CarlTrading  
      Working...
      X