Why is my variable being reset between bars

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #234143 quote
    Morpheous
    Participant
    New

    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 quote
    Morpheous
    Participant
    New

    Sorry my bad. Bug in my code.

    robertogozzi thanked this post
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Why is my variable being reset between bars


Platform Support: Charts, Data & Broker Setup

New Reply
Author
author-avatar
Morpheous @morpheous Participant
Summary

This topic contains 1 reply,
has 1 voice, and was last updated by Morpheous
1 year, 8 months ago.

Topic Details
Forum: Platform Support: Charts, Data & Broker Setup
Language: English
Started: 06/20/2024
Status: Active
Attachments: No files
Logo Logo
Loading...