How can this be an entry?

Forums ProRealTime English forum ProOrder support How can this be an entry?

Viewing 6 posts - 16 through 21 (of 21 total)
  • #183765

     

    once is to initialise the variable once on the first reading of algo

    I get a slight variation in my results if I use ONCE crossflag=0 at the top versus if I use crossflag=0 on its own. But why should there be a difference? If crossflag=0 at the top of the code, shouldn’t be enough to reset it every time the code runs?

    #183766
    JS

    “Once Crossflag=0” will only processed once…

    “Crossflag=0” will be processed every time…

    #183767

    But isn’t each piece of code only processed once? Why would the top line of crossflag=0 be processed more often?

    #183768

    Mike, the code will be executed from top at each close of a bar. For example, if you receive new bars each one minute (this depends on your Chart setting of the instrument), then each one minute the code executes.
    In the example below, this is each 5 minutes.

    #183770
    JS

    And the “once” statement, in your code, will only be executed once…(only the first time)

    #183772

    Okay, thanks. I think I understand it better now. I can see the benefit of ONCE if I need the instruction to stay static for a number of bars while other variables calculate.

    Thanks again for explaining 🙂

Viewing 6 posts - 16 through 21 (of 21 total)

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