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 NullPointStrategies, Yesterday, 05:17 AM
      0 responses
      56 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      133 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      73 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      45 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      49 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X