Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Modifying stop BEFORE entry

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

    Modifying stop BEFORE entry

    Hello,

    its clear how to modify a stop in a trade and I know the sample from Josh.

    But what I want to ask is how to modify a stoploss before an entry. Sounds strange. An example: Setstoploss is 9 Ticks. The marketconditions do change, the conditions in the stop should be different now once triggered the entry in a certain situation and the stop should be there eg 4 Ticks.

    Is this possible to use with SetStoploss please? (I know it would work with different signal names from entryorder but this blows up the code)

    When I change an entrylimitorder rerferring to certain conditions and I code in same bracket the new setstoploss(4 Ticks) will this work or is the setstoploss (9Ticks) used for the entry that has been coded at the beginning of the script (in onbarupdate).

    Would this work so that I have "normal" setstoploss(9 Ticks) but in special situations with new entrylimitorder setstoploss(4 Ticks) or setstoploss (6 Ticks)?

    And I know it would work with exitlongstop. But with exitlongstop we know - from support - that no OCO string is sent, therefore I want to use SetStopLoss.

    Thank you
    Tony

    #2
    Hello tonynt,

    Thanks for your post.

    Yes, you may change the value of the stoploss at any time.

    The thing to keep in mind is that the value of the stoploss will remain at that value until you change it.

    So using your example, you start with a 9 tick stoploss but as you said market conditions suggest to use a 6 tick stop loss so you reissue the setStopLoss() with a 6 tick value. As soon as an entry is made, it will have a 6 tick stop loss. If you do not change the stop loss value, on the next order the stop loss will remain at 6 ticks and it will continue that way until you change the stoploss value.

    Bottom line is the SetStopLoss() will remain at the last level you set.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Hello Paul,

      thank you for your reply. I know that the next stop will be the same.

      The core of the question is - sorry if I didnt translate it accurately - as you write "untill you change it". WHEN or HOW does NT recognize it as changed? When it is later in the script, with higher line-number in the script (can not be when we are working through the script in onbarupdate with if-elseif....)? When it is in onbarupdate changed? Do I have to work with variables like setstoploss ==(Ticks,9) "if conditionA==true then setstoploss = 6, Variablestop = 1} ... "if condition"new" is true then Variablestop =2... if Variablestop== 2 then setstoploss (Ticks, 2)

      ??

      Thank you
      Tony
      Last edited by tonynt; 03-08-2016, 08:41 AM. Reason: typing error

      Comment


        #4
        Hi tonynt,

        Thanks for your reply.

        Ninjatrader will recognize the change as soon as it executes the SetStopLoss() statement.

        For example lets say you have 1000 lines of code and that you have a 10 tick stop loss in line 500 and 6 tick stop loss at line 1000. The very first time the code executes, from line 0 to 499 there is no stop loss and from 500 to 999 there is a 10 tick stop loss. On the last line, the stoploss is set to 6 ticks.
        The next time (Next OnBarUpdate()) the code executes (and from then on) you will have a 6 tick stop loss from lines 0 through 499, on line 500 it will change to a 10 tick stop loss until again line 1000.

        I hope this example is helpful.

        Yes, you can add code that would select different stoploss values.
        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Rapine Heihei, Today, 08:19 PM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by Rapine Heihei, Today, 08:25 PM
        0 responses
        6 views
        0 likes
        Last Post Rapine Heihei  
        Started by f.saeidi, Today, 08:01 PM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by Rapine Heihei, Today, 07:51 PM
        0 responses
        8 views
        0 likes
        Last Post Rapine Heihei  
        Started by frslvr, 04-11-2024, 07:26 AM
        5 responses
        98 views
        1 like
        Last Post caryc123  
        Working...
        X