Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Changing the Price of My Stop Order

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

    Changing the Price of My Stop Order

    I know that I am not allowed to have all three of the orders below in one automated strat:

    --stop loss
    --profit target
    --trailing stop.

    For the most part this is fine, but today something happened that I am sure can be fixed.

    I was attempting to change the price of my stop loss order to be higher after I was in the money so that I would not lose more than a fraction of my profit.

    About 5-10 seconds after keying in my new price in the orders tab, it would revert back to the old price. I then tried to change the price in my IB account manually and it also would not "stay put". The folks on the desk at IB said that NinjaTrader is repeatedly sending out a signal to change the order back to its original price.

    Can this be fixed?

    Any help here would be very greatly appreciated.

    Regards,

    Andrew

    #2
    Hello Andrew,

    It sounds like you are calling SetStopLoss() inside of OnBarUpdate() which is changing your Stop Loss price back to the original price.

    Setting TraceOrders = true to your Initialize() method and you can then view valuable output related to strategy submitted orders through Tools > Output window - TraceOrders

    You may also use Print() statement(s) to verify values are what you expect and to see how your code is being processed - Debugging your NinjaScript code.

    Let us know if we can be of further assistance.
    JCNinjaTrader Customer Service

    Comment


      #3
      Yes my strategy has ten different possible entry points so I have to use (EnterLongLimit) and EnterShortLimit in On Bar Update but I guess there is no compelling reason
      why i cant move all ten stops and all ten profit targets to initialize, is this what you are suggesting?

      Comment


        #4
        Hello Andrew,

        Yes, If you only want your Stop Loss to be set once when the order is placed to a static value then you would want to set it inside Initialize().

        Note that you can still use SetStopLoss() inside of OnBarUpdate() to change your Stop Loss dynamically, but you would have to do this programmatically for each condition. You may see the following thread for an example on how to modify the price of a stop loss and profit target orders programmatically.

        http://www.ninjatrader.com/support/f...ead.php?t=3222

        Let us know if we can be of further assistance.
        JCNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by bortz, 11-06-2023, 08:04 AM
        47 responses
        1,606 views
        0 likes
        Last Post aligator  
        Started by jaybedreamin, Today, 05:56 PM
        0 responses
        8 views
        0 likes
        Last Post jaybedreamin  
        Started by DJ888, 04-16-2024, 06:09 PM
        6 responses
        18 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by Jon17, Today, 04:33 PM
        0 responses
        4 views
        0 likes
        Last Post Jon17
        by Jon17
         
        Started by Javierw.ok, Today, 04:12 PM
        0 responses
        13 views
        0 likes
        Last Post Javierw.ok  
        Working...
        X