Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Dynamic orders

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

    Dynamic orders

    Hello,

    That's what I would like to accomplish:

    Scenario:
    Strategy "A" has
    SetProfitTarget(
    "A", CalculationMode.Percent, 0.1); //10%
    SetStopLoss("A", CalculationMode.Percent, 0.05, false); //5%

    I want to adjust the profit order so that when the 10% is hit the code adds a limit order to the current price of the instrument so that if the instruments goes below it closes the position. Also, the SetProfitTarget order goes from 10% to 15%.

    Is this possible?

    Thanks!


    #2
    Hello TexFly,

    Thank you for your post.

    If the 10% level is hit the Profit Target will be filled, so adjustments and additional orders could not be made to the now closed position.

    However you may wish to set a condition to submit a Limit order to exit below the current price once the 10 % level is hit but have your Profit Target initially at 15%, that way the Profit Target is not filled at 10%.

    Please let me know if this analysis of your example is correct.

    Comment


      #3
      Ok, that makes sense.

      How do I calculate the % of profit in the code and how do I memorize the price level?

      Can you give me some suggestion?

      Thanks!

      Comment


        #4
        Ok, I got that part by myself using
        Position.GetProfitLoss(Close[
        0], PerformanceUnit.Percent (pretty cool BTW)

        Now...what's the best way of (for exmaple) cutting the position in half when that condition is triggered?

        TARGET: When position > 10% cut position in half, when >=15% close it all

        Thanks!

        Comment


          #5
          Hello TexFly,

          Thank you for your response.

          You can use Position.Quantity/2, for information on Position.Quantity please visit the following link: http://www.ninjatrader.com/support/h...7/quantity.htm

          Please let me know if I may be of further assistance.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          647 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          369 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          108 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          572 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          573 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X