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 sjsj2732, Yesterday, 04:31 AM
        0 responses
        32 views
        0 likes
        Last Post sjsj2732  
        Started by NullPointStrategies, 03-13-2026, 05:17 AM
        0 responses
        286 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        283 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        133 views
        1 like
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        91 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Working...
        X