A coding question

Forums ProRealTime English forum ProOrder support A coding question

Viewing 6 posts - 1 through 6 (of 6 total)
  • #197072

    Hi, it would be nice if someone can answer this….

    Are this 2 code are the same and work the same way?

    CLOSE < low[1] or CLOSE < low[2] or CLOSE < low[3] or CLOSE < low[4]

    ——————————————–

    CLOSE < (low[1] or low[2] or low[3] or low[4])

    Many thanks

    #197073

    Hi, it would be nice if someone can answer this….

    Are this 3 code are the same and work the same way?

    CLOSE < low[1] or CLOSE < low[2] or CLOSE < low[3] or CLOSE < low[4]

    ——————————————–

    CLOSE < (low[1] or low[2] or low[3] or low[4])

    ————————————————-

    c1 = CLOSE < low[1]

    c2 = CLOSE < low[2]

    c3 = CLOSE < low[3]

    c4 = CLOSE < low[4]

    s1 = c1 or C2 or C3 or c4

    Many thanks

     

    #197074

    If you number your options then it’s easier fior us to help you as we can easily refer to numbers. 🙂

    This

    S1 = CLOSE < low[1] or CLOSE < low[2] or CLOSE < low[3] or CLOSE < low[4]

    is same as

    c1 = CLOSE < low[1]

    c2 = CLOSE < low[2]

    c3 = CLOSE < low[3]

    c4 = CLOSE < low[4]

    s1 = c1 or C2 or C3 or c4

     

    This one

    CLOSE < (low[1] or low[2] or low[3] or low[4])

    won’t work for what you want it to do, e.g. or  low[2]  will only give you the value of low 2 bars ago.

    1 user thanked author for this post.
    #197075
    JS

    In addition to GraHal’s explanation:

    You can set up a simple indicator to test…

    Then you see that Code1 and Code3 give the same results (0 or 1) but that Code2 is always true (always 1). This is probably because in Code2 you don’t give a condition to Low[2], Low[3] and Low[4]. So you’re basically saying here, is there a Low[2] or a Low[3] or a Low[4] (and there always are).

    2 users thanked author for this post.
    #197077

    As to your first post:

    • the first line is correct, it’ll be true whenever CLOSE < anyone of the previous 4 LOWs
    • the second line is logically incorrect, as it will ALWAYS be true, as you do not compare CLOSE to those LOWS; you compare CLOSE to the fact that anyone of those LOWs is <> 0, which cannot be false.

     

    #197082

    thank you guys, got it now, very appreciate 🙂

Viewing 6 posts - 1 through 6 (of 6 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login