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 jclose, Yesterday, 09:37 PM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by firefoxforum12, Yesterday, 08:53 PM
        1 response
        14 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by kmunroe478, Yesterday, 05:39 PM
        2 responses
        15 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by kevinenergy, 02-17-2023, 12:42 PM
        115 responses
        2,700 views
        1 like
        Last Post kevinenergy  
        Started by prdecast, Today, 06:07 AM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Working...
        X