Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

where to put the stops

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

    where to put the stops

    Hello,

    I want to ask please if there might be any problem when I move my setstoploss from onbarupdate to onExecution. (The reason is that I want to move my stops referring to market conditions but when I have the stops in onbarupate then they switch back always to the position determined in the script and do not stay at the new position).

    Thank you
    Tony

    #2
    Hi Tony,

    While it is ok to set SetStopLoss in OnExecution, this will be after the entry order has already filled. This means that the stop loss will initially use whatever it was set to in its last use and then will be changed once you call SetStopLoss again.

    Really, the best way to use SetStopLoss is before you call the entry order.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea,

      thank you for your reply and the idea.

      So, to work out my idea with changing the stoplosses as an option beside what is defined in the script and leave it in OnBarUpdate I could use a flag or variable, right?

      double stopscript == 1;

      if(Position.MarketPosition == MarketPosition.Long && Bid > x* TickSize && stopscript ==1)
      SetStopLoss ( to new Position)

      I handle my trades after the entry with customized buttons, so I make a button to switch stopscript to 0 or 1. When I want to change my stop manually to another value than I have in the script I switch it to 0 and so it will not change with onbarupdate. Correct?


      Thanks
      Tony




      Originally posted by NinjaTrader_ChelseaB View Post
      Hi Tony,

      While it is ok to set SetStopLoss in OnExecution, this will be after the entry order has already filled. This means that the stop loss will initially use whatever it was set to in its last use and then will be changed once you call SetStopLoss again.

      Really, the best way to use SetStopLoss is before you call the entry order.

      Comment


        #4
        Hi tonynt,

        I haven't tested that and using buttons is unsupported, but yes that should work fine.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        71 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        39 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        63 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        63 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        53 views
        0 likes
        Last Post CarlTrading  
        Working...
        X