Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Moving Stop

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

    Moving Stop

    I am trying to program a moving stop into my strategy through very basic script.


    My goal is to get the stop loss to update at the end of the formation of every price bar after my signal has entered an entry.

    For instance: I have a buy signal telling me to place a long stop limit order at the high of the current 30 minute bar + 1 tick ( the signal bar). My initial stop loss point is the low of the signal bar -1 tick. At the conclusion of the current bar, (election bar), if my profit target has not been hit, I would like my stop loss to move to the low of the election bar -1 tick.

    Here is my initial script for the Signal bar stop :
    SetStopLoss(CalculationMode.Price, Low[
    0]+ -1* TickSize);

    How can I get my stop loss to update on the completion of every successive bar until my profit target is hit, or my new stop is hit?


    #2
    Here is a picture of what I am trying to do.

    Click image for larger version

Name:	CL 01-12 (30 Min)  12_10_2008.jpg
Views:	1
Size:	54.2 KB
ID:	864288


    I would like the stop to move to the High of the next successive bar after entry, untill either I am stopped out, or my profit target is hit.

    In this case my sell signal is on the large red bar's low -1tick, sell entry at 8402....the profit target was not hit, so thus my stop would be the high of the second bar + 1tick. In this case it is the small green bar immediately following the sell signal +1tick . I would have been stopped out during the formation of the third bar.
    Last edited by vern13; 12-06-2011, 10:13 PM.

    Comment


      #3
      You would just need to call the SetStopLoss with your calculated stop loss value if you are in the position, this would update the stop if needed.

      To visually see where exactly the calculated stop value would be, please draw for example a dot at the very price level, it can be an excellent debug help.

      Comment


        #4
        Originally posted by NinjaTrader_Bertrand View Post
        You would just need to call the SetStopLoss with your calculated stop loss value if you are in the position, this would update the stop if needed.

        To visually see where exactly the calculated stop value would be, please draw for example a dot at the very price level, it can be an excellent debug help.

        I am a bit confused on what you mean by "calling the SetStopLoss with my calculated stop value" . Haven't I already done that with the script I have?
        Is what I have remotely close? It is functional in identifying the initial stop, but as we go forward in time, the stop does not move to the low of the current bar -1tick.

        SetStopLoss(CalculationMode.Price, Low[0]+ -1* TickSize);


        Thank you advance, any help is much appreciated

        Comment


          #5
          Originally posted by vern13 View Post
          I am a bit confused on what you mean by "calling the SetStopLoss with my calculated stop value" . Haven't I already done that with the script I have?
          Is what I have remotely close? It is functional in identifying the initial stop, but as we go forward in time, the stop does not move to the low of the current bar -1tick.

          SetStopLoss(CalculationMode.Price, Low[0]+ -1* TickSize);


          Thank you advance, any help is much appreciated
          You would call the SetStopLoss() on every bar after you entered the trade. So that way the Stop Loss is updated on every new bar.

          Comment


            #6
            Originally posted by vern13 View Post
            I am a bit confused on what you mean by "calling the SetStopLoss with my calculated stop value" . Haven't I already done that with the script I have?
            Is what I have remotely close? It is functional in identifying the initial stop, but as we go forward in time, the stop does not move to the low of the current bar -1tick.

            SetStopLoss(CalculationMode.Price, Low[0]+ -1* TickSize);


            Thank you advance, any help is much appreciated
            vern13, your SetStopLoss call is only in the Initialize() method, correct?

            For a dynamically updating stop please call it in OnBarUpdate() and reset as well when flat.

            Much is covered in this example : http://www.ninjatrader.com/support/f...ead.php?t=3222

            Comment


              #7
              ok....I am already set up for the OnBarUpdate() ...I will look the examples and see if I can organize the script correctly.

              Comment


                #8
                Sounds good, please take a look at the example and ensure the reset part when flat is in your script as well. TraceOrders are a very useful tool in debugging your strategy orders, they print to the output window (Tools > Output Window from the NT Control Center).

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                648 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                369 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                108 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                572 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                573 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X