• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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 baluga123, Today, 08:19 AM
        1 response
        21 views
        0 likes
        Last Post NinjaTrader_Kate  
        Started by Gregory Arkadin, Today, 12:30 PM
        0 responses
        4 views
        0 likes
        Last Post Gregory Arkadin  
        Started by fx.practic, Today, 12:04 PM
        1 response
        8 views
        0 likes
        Last Post fx.practic  
        Started by szayedoud, Today, 11:49 AM
        0 responses
        7 views
        0 likes
        Last Post szayedoud  
        Started by Rugosoft, Today, 10:41 AM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Jim  
        Working...
        X