OR function in indicator don’t work…

Forums ProRealTime English forum ProBuilder support OR function in indicator don’t work…

  • This topic has 2 replies, 3 voices, and was last updated 1 year ago by avatarJS.
Viewing 3 posts - 1 through 3 (of 3 total)
  • #205926

    I made a script for finding equal lows on the DAX. I look for differences of 0, 0.5 and 1 points, because the price sometimes deviates slightly.

    Now I have made the script below, so that a line is placed on the graph. The problem is that the script can’t handle searching for 0, 0.5 and 1 simultaneously. I’ve used the function with OR and it doesn’t seem to work. I can of course put the formula in the script again to create three conditions, but it seems to me that there is a smarter way to do it.

    If I enter 1 value in Af1 it works perfectly, but with multiple values using the OR function it doesn’t work.

    Who knows how I can cleverly include this in the script with Af1= 0 OR 0.5 OR 1. What am I overlooking? 🙂

     

    //DAX same lows
    //26-11-22

    Af1 = 0 OR 0.5 OF 1

    //Same lows
    for p = 4 to 100 do
    if ABS(low[1] – low[p]) = Af1 THEN
    x1 = barindex[1]
    y1 = low[1]
    x2 = barindex[p]
    y2 = low[p]
    endif
    next
    DRAWSEGMENT (x1,y1,x2,y2)coloured(255,10,10)
    RETURN

    #205927

    Hi,

    “or” is for booleans, not for choosing among various numbers.

    You could say you want anything between 0 and 1, with 1 included, by keeping a simple Af1=1 , and by using <= (it means inferior or equal to) this way:

    if ABS(low[1] – low[p]) <= Af1 THEN

    #205929
    JS

    Hi @Robin81

    You can try this one…

     

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

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