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 cre8able, Yesterday, 01:16 PM
          3 responses
          11 views
          0 likes
          Last Post cre8able  
          Started by ChartTourist, Today, 08:22 AM
          0 responses
          5 views
          0 likes
          Last Post ChartTourist  
          Started by LiamTwine, Today, 08:10 AM
          0 responses
          2 views
          0 likes
          Last Post LiamTwine  
          Started by Balage0922, Today, 07:38 AM
          0 responses
          5 views
          0 likes
          Last Post Balage0922  
          Started by JoMoon2024, Today, 06:56 AM
          0 responses
          6 views
          0 likes
          Last Post JoMoon2024  
          Working...
          X