Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Between operator in C#, time filter, check values...

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

    #16
    Thank you, Dave, I truly appreciate your help!
    Last question, not on the topic... Is there bool substitution or coalesce or such thing? If bool1 - f, bool2-f,..bool 3 - f.. return bool n?
    Thank you very much again.
    Art.

    Comment


      #17
      Unfortunately I have no idea what you mean. This does look a lot like what you have asked in previous threads.

      What does coalesce mean?

      What does this mean

      If bool1 - f, bool2-f,..bool 3 - f.. return bool n?
      If bool1 is false, bool2 is false, bool3 is false, return bool n???

      I'm sorry, it's completely non descriptive and non-rigorous.

      Comment


        #18
        Sorry Dave. You're right, it is not on the topic. Here's the link to boolean question thread - http://www.ninjatrader.com/support/f...highlight=bool
        I'm trying to get as much info as possible from everyone who's willing to share...
        Here are some explanations: I was asking about substitution for booleans, e.g. if bool1 false then return bool2... If there's more then two boolean vals. then check which one is true and return it, e.g. check bool1, 2, 3,... bool n - true - then return true.

        SQL:

        COALESCE(expression1,...n) is equivalent to the following CASE expression:
        CASE
        WHEN (expression1 IS NOT NULL) THEN expression1
        WHEN (expression2 IS NOT NULL) THEN expression2
        ...
        ELSE expressionN
        END

        Is there such thing in C# in general? If there is can this be used for boolean types? If you reply then you can reply to this or bool thread:



        Thank you very much.

        Comment


          #19
          Originally posted by Art09 View Post
          COALESCE(expression1,...n) is equivalent to the following CASE expression:
          CASE
          WHEN (expression1 IS NOT NULL) THEN expression1
          WHEN (expression2 IS NOT NULL) THEN expression2
          ...
          ELSE expressionN
          END
          .
          Yes, of course, it's easy and if you did the tutorials you'd see that.

          TypeOfExpr Coalesce() {

          if (expr1 != null) return expr1;
          else if (expr2 != null) return expr2;
          etc
          }

          If you don't follow this syntax you really need to do a c# tutorial.

          regards
          Dave

          Comment


            #20
            If i understand correctly there is no such thing as a single line statement (command/method) in C# such as: expr_to_return = Coalesce(expr1, expr2, expr3.... expr-n) and I have to actually write the whole program or method to Coalesce() as in your example? I was kind of hoping for a single line statement... And Coalesce() as in your example can be used with boolean expressions, correct?
            Thank you very much.

            Comment


              #21
              If i understand correctly there is no such thing as a single line statement (command/method) in C# such as: expr_to_return = Coalesce(expr1, expr2, expr3.... expr-n) and I have to actually write the whole program or method to Coalesce() as in your example? I was kind of hoping for a single line statement...
              I would have just coded it as I wrote. It's not a problem for me. However there is a coalesce operator in c#. You would have found it if you'd typed c# coalesce into Google. Much faster than asking me.


              And Coalesce() as in your example can be used with boolean expressions, correct?
              Thank you very much
              I've no idea if it works with bools. I don't see why not, but there's only one way to find out, and who do you think should try it, you or me?

              regards
              Dave

              Comment


                #22
                Thank you very much, Dave!
                Art.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by wzgy0920, 02-22-2024, 01:11 AM
                5 responses
                32 views
                0 likes
                Last Post wzgy0920  
                Started by wzgy0920, Yesterday, 09:53 PM
                2 responses
                49 views
                0 likes
                Last Post wzgy0920  
                Started by Kensonprib, 04-28-2021, 10:11 AM
                5 responses
                191 views
                0 likes
                Last Post Hasadafa  
                Started by GussJ, 03-04-2020, 03:11 PM
                11 responses
                3,230 views
                0 likes
                Last Post xiinteractive  
                Started by andrewtrades, Today, 04:57 PM
                1 response
                14 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Working...
                X