Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Cannot modify SetStopLoss and a SetProfitTarget.

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

    Cannot modify SetStopLoss and a SetProfitTarget.

    Hello
    in the strategy, a SetStopLoss and a SetProfitTarget are defined
    when an order is executed, i cannot be modified.
    this means if you i move them with the mouse, they return to their initial place
    Is there a solution to change them after order is executed?
    Thank you in advance

    #2
    Hi aekzof, thanks for writing in. You must use an Exit method with the int barsInProgressIndex parameter overload. E.g.

    ExitLongStopMarket(int barsInProgressIndex, bool isLiveUntilCancelled, int quantity, double stopPrice, string signalName, string fromEntrySignal);

    This will keep the order alive without needing to re-submit on every bar so you can move it around. This should be set after placing the entry order.

    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Merci .

      Comment


        #4
        Hi Chris,

        on the above, how do I set the 'double stop price' in the ExitLongStopMarket to an indicator such as an EMA? Do I just put the EMA[Close, 0] as the 'double stop price' or do I need to load the EMA into a variable and set that variable in the 'double stop price'? Looking to have that Limit order appear and 'move' in the same way it would when I attach an order to an indicator from that 'attach to an indicator' chart function.

        Comment


          #5
          Hello Austiner87,

          When you see double as a parameter that means you can use any double type number, indicators return double type numbers so that could be used.

          If the price of the EMA makes sense for the order used you could just specific the indicator directly;

          Code:
          ExitLongStopMarket(int barsInProgressIndex, bool isLiveUntilCancelled, int quantity, [B]EMA(12)[0][/B], string signalName, string fromEntrySignal);
          If that price gives errors like the order was placed on the wrong side of the market then you would need to use a variable in that case to calculate a correct price or check if the price you used is on the correct side of the market before submitting the order.
          JesseNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Jimmyk, 01-26-2018, 05:19 AM
          6 responses
          835 views
          0 likes
          Last Post emuns
          by emuns
           
          Started by jxs_xrj, 01-12-2020, 09:49 AM
          6 responses
          3,291 views
          1 like
          Last Post jgualdronc  
          Started by Touch-Ups, Today, 10:36 AM
          0 responses
          10 views
          0 likes
          Last Post Touch-Ups  
          Started by geddyisodin, 04-25-2024, 05:20 AM
          11 responses
          62 views
          0 likes
          Last Post halgo_boulder  
          Started by Option Whisperer, Today, 09:55 AM
          0 responses
          9 views
          0 likes
          Last Post Option Whisperer  
          Working...
          X