Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Closing a long, and reversing

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

    Closing a long, and reversing

    Hello,

    I'm running into some "Internal Order Handling" errors that I hope someone can help with suggestions.

    My entry long code is as follows:


    Code:
        
    longEntryPrice = Close[0];
    longStopPrice = hanick.SignalPrice[0];
                        
    longEntry1 = EnterLongLimit(0, true, tradeSize, longEntryPrice, "LE1");
    longEntry2 = EnterLongLimit(0, true, tradeSize, longEntryPrice, "LE2");
    SetStopLoss("LE1", CalculationMode.Price, longStopPrice, false);
    SetStopLoss("LE2", CalculationMode.Price, longStopPrice, false);
    Instead of a set profit target, my strategy calls for an exit and a reversal to short once a specific criteria is met.

    I've coded my exit/reverse code as follows:

    Code:
    ExitLong("ExLong2","LE1");
    ExitLong("ExLong1", "LE2");
                    
    shortEntry1 = EnterShortLimit(0, true, tradeSize, Close[0], "SE1");
    shortEntry2 = EnterShortLimit(0, true, tradeSize, Close[0], "SE1");
    Both the EnterShortLimit() will not place due to Order Handling Rules. Now, I understand there are some restrictions in place when it comes to using the Managed Approach. In my case, is there any way to "trick" NT into doing what I want it to do? (Perhaps using a different algo to set stops, etc.). I would REALLY like to avoid using the Unmanaged Approach if at all possible.

    Any help would be appreciated.

    Regards,
    Nick

    #2
    Originally posted by nicbizz View Post
    Hello,

    I'm running into some "Internal Order Handling" errors that I hope someone can help with suggestions.

    My entry long code is as follows:


    Code:
        
    longEntryPrice = Close[0];
    longStopPrice = hanick.SignalPrice[0];
                        
    longEntry1 = EnterLongLimit(0, true, tradeSize, longEntryPrice, "LE1");
    longEntry2 = EnterLongLimit(0, true, tradeSize, longEntryPrice, "LE2");
    SetStopLoss("LE1", CalculationMode.Price, longStopPrice, false);
    SetStopLoss("LE2", CalculationMode.Price, longStopPrice, false);
    Instead of a set profit target, my strategy calls for an exit and a reversal to short once a specific criteria is met.

    I've coded my exit/reverse code as follows:

    Code:
    ExitLong("ExLong2","LE1");
    ExitLong("ExLong1", "LE2");
                    
    shortEntry1 = EnterShortLimit(0, true, tradeSize, Close[0], "SE1");
    shortEntry2 = EnterShortLimit(0, true, tradeSize, Close[0], "SE1");
    Both the EnterShortLimit() will not place due to Order Handling Rules. Now, I understand there are some restrictions in place when it comes to using the Managed Approach. In my case, is there any way to "trick" NT into doing what I want it to do? (Perhaps using a different algo to set stops, etc.). I would REALLY like to avoid using the Unmanaged Approach if at all possible.

    Any help would be appreciated.

    Regards,
    Nick
    There have been some pretty long, and sometimes not very pleasant threads on this issue. You might want to take a look at these two, where admittedly, I am one of the major protagonists:


    Support for the development of custom automated trading strategies using NinjaScript.

    Comment


      #3
      Thanks Koganam,

      In the end, I bit the bullet and went with Unmanaged. It was simply too much trouble sequencing orders through IExecution.

      -Nick

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      657 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      373 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      109 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      574 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      579 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X