Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

condition

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

    condition

    Hello .
    Am I correct to describe the condition :
    if (Close[1]> Open[1] ==Open[0]> Close[0] ) ; ???
    See attachment:
    Attached Files
    Last edited by alex@n; 04-13-2017, 01:40 AM.

    #2
    Hello alex@n, and thank you for your question. to describe this situation you will want to use && instead of ==, so that your statement becomes

    Code:
    if (Close[1] > Open[1] [B]&& [/B]Open[0] > Close[0])
    Please let us know if there are any other ways we can help.
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      Hello JessicaP ,
      thank you for your answer,
      if (Close[1] > Open[1] && Open[0] > Close[0]) , No, it does not fit.
      See attachment:https://www.screencast.com/t/NjHEKqF1ea

      Comment


        #4
        Can you clarify what is meant by error in this case? The picture I am seeing draws a blue diamond over every red bar following a green bar.
        Jessica P.NinjaTrader Customer Service

        Comment


          #5
          Conditions
          Close[1] Bull bar == Open[0] Bear bar .
          Last edited by alex@n; 04-13-2017, 09:23 AM.

          Comment


            #6
            Thank you. Let's go ahead and put what we want into plain language. Please correct me if I'm wrong. Our goal is to detect the situation where

            • The previous bar is bullish and the current bar is bearish
            • The candlestick shapes of the previous bar and current bar are the same

            If this is the case, the condition I gave you before handles the first bullet only. In plain language, when we say that the previous bullish bar has the same candlestick shape as the current bearish bar, we mean that all of the following are true :


            • The previous bullish bar's close is equal to the current bearish bar's open
            • The previous bullish bar's open is equal to the current bearish bar's close
            • The previous bullish bar's high is equal to the current bearish bar's high
            • The previous bullish bar's high is equal to the current bearish bar's high

            So we can put everything together like this


            Code:
            if (
                // The previous bar is bullish and the current bar is bearish
                (Close[1] > Open[1] && Open[0] > Close[0])
            
            
                // The candlestick shapes of the previous bar and current bar are the same
                && (Close[1] == Open[0])
                && (Close[0] == Open[1])
                && (High[1] == High[0])
                && (Low[1] == Low[0])
                )
            Jessica P.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_JessicaP View Post
              Thank you. Let's go ahead and put what we want into plain language. Please correct me if I'm wrong. Our goal is to detect the situation where

              • The previous bar is bullish and the current bar is bearish
              • The candlestick shapes of the previous bar and current bar are the same

              If this is the case, the condition I gave you before handles the first bullet only. In plain language, when we say that the previous bullish bar has the same candlestick shape as the current bearish bar, we mean that all of the following are true :


              • The previous bullish bar's close is equal to the current bearish bar's open
              • The previous bullish bar's open is equal to the current bearish bar's close
              • The previous bullish bar's high is equal to the current bearish bar's high
              • The previous bullish bar's high is equal to the current bearish bar's high

              So we can put everything together like this


              Code:
              if (
                  // The previous bar is bullish and the current bar is bearish
                  (Close[1] > Open[1] && Open[0] > Close[0])
              
              
                  // The candlestick shapes of the previous bar and current bar are the same
                  && (Close[1] == Open[0])
                  && (Close[0] == Open[1])
                  && (High[1] == High[0])
                  && (Low[1] == Low[0])
                  )
              Thank you !

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              566 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              330 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              101 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              547 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              548 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X