Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

"if" or "or"

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

    "if" or "or"

    Hello,

    I want to ask please how to do best when there are different setups in a NT-script-strategie. Lets assume there are 2 setups, setup A can be true under certain market conditions and setup B can be true under other market conditions. But there can be a situation where both are true. But only one entry should be done - even when both conditions/setups are true. Is it better to do:

    a.) if(setup 1 || setup 2) then do

    b.) if(setup1) then do
    if(setup2) then do
    in this case also with same signal names and with Unique.Entries per direction

    How one should do please to avoid problems with entries when one want to have only one entry.

    Thank you
    Tony

    #2
    Tony, did you mean working with unique signal names?

    As if you were naming both setup entries identical and working with all entries as entry handling, only one entry would be allowed by NT.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hello Bertrand,

      thank you for your reply.

      After clicking on submit reply button I had the idea that with if (setup1) and elseif(setup2) I could avoid for sure all problems with 2 conditions true the same moment. Correct?

      Thank you
      Tony

      Originally posted by NinjaTrader_Bertrand View Post
      Tony, did you mean working with unique signal names?

      As if you were naming both setup entries identical and working with all entries as entry handling, only one entry would be allowed by NT.

      Comment


        #4
        Correct Tony, combine that simply with entry handling set to do one (all) entry and you should be really good.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Hello Bertrand,

          as Q&A goes fast and easy today;-) please let me do one question concerning stops - I didn´t understand it untill now.

          Is there a difference if my "initial"setstoploss is set in "Initialize" or in "OnBarUpdate" with "if flat..then setstoploss)" to have stops for sure immediately with the entries.

          The reason why I want to have it in onbarupdate is because I want to have the stops with a variable (and I understand that this I can not do in initialize).

          Might there be a problem when setstoploss is not in Initialize but in OnBarUpdate? Or it doesn´t matter which one I do?

          (And if it might be a problem with setstoploss in onbarupdate then please let me know if I can check somehow if eg 3 setstoplosses - for 3 entries - are accepted, because if I can check then I could bring in the stoplosses in Initialize and when accepted then I can immediately change to setstoplosses with my variable.

          Thank you
          Tony
          Last edited by tonynt; 01-16-2014, 06:11 AM. Reason: translation error

          Comment


            #6
            Tony, in this case you really want them in OnBarUpdate() since the your variable would be dynamic, correct? So tied to something you calculate via the script? Initialize() would only allow for a static stop to be set which would applied to all positions.

            The setting of the stop adjustment itself is done per your condition, so OnBarUpdate() would need to be called for this to happen - so there isn't generally an issue you just have to aware when the event would be called to evaluate your condition and do the adjustment.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Thank you!

              Originally posted by NinjaTrader_Bertrand View Post
              Tony, in this case you really want them in OnBarUpdate() since the your variable would be dynamic, correct? So tied to something you calculate via the script? Initialize() would only allow for a static stop to be set which would applied to all positions.

              The setting of the stop adjustment itself is done per your condition, so OnBarUpdate() would need to be called for this to happen - so there isn't generally an issue you just have to aware when the event would be called to evaluate your condition and do the adjustment.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by wzgy0920, 04-20-2024, 06:09 PM
              2 responses
              27 views
              0 likes
              Last Post wzgy0920  
              Started by wzgy0920, 02-22-2024, 01:11 AM
              5 responses
              32 views
              0 likes
              Last Post wzgy0920  
              Started by wzgy0920, 04-23-2024, 09:53 PM
              2 responses
              49 views
              0 likes
              Last Post wzgy0920  
              Started by Kensonprib, 04-28-2021, 10:11 AM
              5 responses
              193 views
              0 likes
              Last Post Hasadafa  
              Started by GussJ, 03-04-2020, 03:11 PM
              11 responses
              3,235 views
              0 likes
              Last Post xiinteractive  
              Working...
              X