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 CaptainJack, 04-24-2026, 11:07 PM
        0 responses
        19 views
        0 likes
        Last Post CaptainJack  
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        120 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        174 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        92 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        134 views
        0 likes
        Last Post cmoran13  
        Working...
        X