Why is my variable being reset between bars

Forums ProRealTime English forum ProRealTime platform support Why is my variable being reset between bars

Viewing 2 posts - 1 through 2 (of 2 total)
  • #234143

    In this code, the value of signal is being reset to zero for each bar, why would that happen? I have another indicator doing similar things and the variable does not get reset

     

    //Entanglement indicator

    //timeframe(1 hour,updateonclose)

    BolUp1,BolDown1, BolUp2, BolMiddle, BolDown2, BolUp3, BolDown3, BolUp1Direction, BolDown1Direction, BolUp2Direction, BolDown2Direction=CALL “#HourlyBollinger”

    timeframe(5 Minute, updateonclose)
    if openhour=20 and openminute=55 then
    signal=0
    endif

    // Signal values
    // 1 entangled with BB1
    // 2 entangled with BB2
    // -1 entangled with BB-1
    // -2 entangled with BB-2
    if close>=BolUp1 then
    signal=1
    endif

    if close>=BolUp2 then
    signal=2
    endif

    if close<=BolDown1 then
    signal=-1
    endif

    if close<=BolDown2 then
    signal=-2
    endif

     

    return signal as “Entanglement”

    #234144

    Sorry my bad. Bug in my code.

    1 user thanked author for this post.
Viewing 2 posts - 1 through 2 (of 2 total)

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