Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Conditional And/Or Ennry

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

    Conditional And/Or Ennry

    hi NT8 support,

    I realize this is an extremely simple syntax question, but how do I bundle If statements together for If and / If Or. Example

    If( Condition 1
    && Condition 2

    ||

    Condition 1
    Condition 3
    )

    Is there a way to bundle them so I only have to write condition 1 once for a (All need this condition), and so I can pare down the number of total OR statements and their lenth for the number of if statements. thank you!

    #2
    Hello Austiner87,
    You can use as below:-
    Code:
    if( (condition1 && condition2) || (condition3 && condition4) )
    //your code
    else
    //your code
    Hope it helps!

    Comment


      #3
      Hello Austiner87,

      Thanks for your post.

      If I understand correctly you are looking to reduce down the code by only using Condition1 once.

      You currently have if(Condition1 && Condition2 || Condition1 && Condition3), true if 1 + 2 or 1 + 3

      You could rewrite as if (Condition1 && (Condition2 || Condition3)) True if 1+ (2 or 3)

      Comment


        #4
        Extremely helpful, thank you

        Comment


          #5
          Hello S.Kinra,
          I didn't know if I should post here or start a new thread. Let me know if I should just start a new thread. Thanks.

          I'm currently trying to do what the person above was asking. See below: (I getting a lot of chart markers printing on random bars). I have the first condition being one or the other and then the rest of the conditions. Am I trying to do this correctly?

          Thanks again for your time.
          Regards
          James

          if (

          (GomOrderFlowProValues1.RatioLow[0] > RS)
          || (GomOrderFlowProValues1.RatioLow[0] < RW)

          && (Close[0] > Open[0])
          && (Enable_RIA == true)
          && (ShowCT_RIA == false)
          // Trend Filter Disabled
          && (TrendFilter == false)

          // Number Buy IMB
          && (GomOrderFlowProValues1.NbBuyImbalances[0] >= NumberIMB)
          // HiWay Long
          && (Close[0] > EMA1[0])
          //Trend Threshold Value
          && (TOTrimi1[0] < TrendHighThreshold)

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by CarlTrading, 03-31-2026, 09:41 PM
          1 response
          78 views
          1 like
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          40 views
          0 likes
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          63 views
          2 likes
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          63 views
          0 likes
          Last Post CarlTrading  
          Started by CarlTrading, 03-30-2026, 11:48 AM
          0 responses
          54 views
          0 likes
          Last Post CarlTrading  
          Working...
          X