Initial values of variables

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #213341 quote
    Johnsteed
    Participant
    Junior

    A short question please to the platform experts about initial values of build-in variables:

    Wenn coding lines like

    condition=close < close[1]

    and the code line is evaluated at barindex=0, which value does the variable close[1] ( or say all close[n] for n>0 ) assume?

    For example, is this always reliably set equal to close[0], or to undefined, or can it be an arbitrary value depending on platform memory varying conditions?

    From the answer, it should become clear which value the variable condition would assume at barindex=0?

    Likewise, do other build-in variables have a predefined behaviour when attempting to call previous data at barindex=0?

    Thank you.

    #213376 quote
    robertogozzi
    Moderator
    Master

    Probuilder always preloads 500+ bars, so it’s just the prior closing price.

    #213378 quote
    robertogozzi
    Moderator
    Master

    Only post in the language of the forumthat you are posting in. For example English only in the English speaking forums and French only in the French speaking forums.

    I moved it from the German forum.

    Thanks 🙂

    #213590 quote
    Johnsteed
    Participant
    Junior

    Sorry I do not understand the techncial answer: How many bars are preloaded is defined by the PRELOADBARS statement, which allows varying data. It can be zero or something else. And PRELOADBARS work in trade systems only, not indicators.

    So my question is yet open.

    And sorry to have picked the wrong language forum, I’m definitely aware about the matter, was just my mistake, so thanks for the correction.

    #213597 quote
    GraHal
    Participant
    Master

    It is my understanding that the default Preloadbars is 2000 (without us needing to specify).

    We can code Defparam PreLoadBars = 10000 (10000 is the maximum).

    Hope this helps?

    #213608 quote
    robertogozzi
    Moderator
    Master

    No, ProBuilder preloads a fixed number of bars, which can’t be set by the user (differently from strategies, which can set preloaded bars from 0 to 10K).

    As you can see from the attached pic, on a 25-unit chart, the first barindex for bar 0 is actually 500.

    Simply create this indicator:

    RETURN BarIndex AS "BarIndex info"
    GraHal thanked this post
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

Initial values of variables


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Johnsteed @johnsteed Participant
Summary

This topic contains 5 replies,
has 3 voices, and was last updated by robertogozzi
2 years, 9 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 04/16/2023
Status: Active
Attachments: 1 files
Logo Logo
Loading...