How can I prevent overwriting of existing values?

Forums ProRealTime English forum ProBuilder support How can I prevent overwriting of existing values?

  • This topic has 5 replies, 3 voices, and was last updated 3 days ago by avatarIván.
Viewing 6 posts - 1 through 6 (of 6 total)
  • #248173

    Hi all,

    recently I was converting an indicator from Tradingview to ProBuilder.
    The thing, I can’t get solved is:

    When a new candles forms, the previous calculated value of the indicator is still visible while the newer one overlays/overwrites the previous value.

    I tried to fix this with if

    islastbarupdate then
    drawtext(value, x, y) …
    endif

    Does anyone have any ideas how to solve this?

    See pic. attached.

    Thank you so much in advance.

    Best regards,
    Florian

    #248175
    JS

    Hi Florian,

    Have you tried this instruction at the beginning of your code…?

    DefParam DrawOnLastBarOnly=True

    3 users thanked author for this post.
    #248179

    Hi JS,

    First of all: Thank you for your fast response.

    Yes, I tried this but as I also have a condition to color my candles it won’t work as I intended to. It would then limit the colored candles to the current one instead of all of them.
    If there is a work around to still have all candles colored, please let me know.

    Thanks,
    Florian

    #248183
    JS

    What you can try is to split your indicator into two parts, one part for coloring your candles (without “DrawOnLastBarOnly”) and one for the text using DrawOnLastBarOnly…

    2 users thanked author for this post.
    #248188

    Yeah, I already thought about that. Thanks for the reminder.

    So there is no other way around to solve this issue?

    Honestly I’m not a huge fan of having a bunch of indicators on my chart.

    #248189

    There is a way… You could store variables in arrays and then use a loop.
    here you have an example:

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

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