Announcement

Collapse
No announcement yet.

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.

    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.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by CarlTrading, 03-31-2026, 09:41 PM
          1 response
          81 views
          1 like
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          42 views
          0 likes
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          64 views
          2 likes
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          66 views
          0 likes
          Last Post CarlTrading  
          Started by CarlTrading, 03-30-2026, 11:48 AM
          0 responses
          54 views
          0 likes
          Last Post CarlTrading  
          Working...
          X