Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exit Order Management for Stop and Profit Order

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

    Exit Order Management for Stop and Profit Order

    Hello,

    Please suggest and provide sample code for managing exit order like below scenerio

    Entry Position size: 3, LONG, price: X

    Exit StopOrder size: 3, SHORT, X - 5 * TickSize
    EXIT ProfitOrder size:1, SHORT, X + TickSize
    EXIT ProfitOrder size:1, SHORT, X + 2 * TickSize
    EXIT ProfitOrder size:1, SHORT, X + 5 * TickSize

    Sample code will be helpful.

    Regards,
    Ziaul

    #2
    Ziaul, you can look into and work with this example here to get started scaling out of your position with a script - http://www.ninjatrader.com/support/f...ead.php?t=3751

    Comment


      #3
      Thanks for your early reply.

      To solve my above issue, I write below code. Please check it and let me know.

      --- code below --

      signalName = "LONG_SIGNAL";

      for (int counter=1;counter <= 3; counter++)
      {
      //Sending 1 lot, c signal name i am changing everytime
      EnterShort(1, 1, signalName + counter.ToString());


      //Set Stoploss and profit order
      // Profit order wud be sent on different price. different level.
      SetStopLoss(signalName + counter.ToString(),CalculationMode.Ticks, 3, false);

      if (counter == 1)
      {
      SetProfitTarget(signalName + counter.ToString(), CalculationMode.Price, level1ProfitPrice);
      }
      else if(counter == 2)
      {
      SetProfitTarget(signalName + counter.ToString(), CalculationMode.Price, level2ProfitPrice);
      }
      else
      {
      SetProfitTarget(signalName + counter.ToString(), CalculationMode.Price, level3ProfitPrice);
      }
      }


      Let me know if you need any more details.


      Regards,
      Ziaul
      Last edited by ziaul; 04-10-2013, 04:49 AM. Reason: Wrong sent

      Comment


        #4
        Looks good to me from a quick visual, I would now suggest giving it a test in backtesting / simulation in your preferred market - please also ensure to use the correct EntryHandling settings -

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        156 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        90 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        138 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        130 views
        1 like
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        107 views
        0 likes
        Last Post CarlTrading  
        Working...
        X