How can I prevent overwriting of existing values?
- This topic has 6 replies, 3 voices, and was last updated 4 months ago by .
Viewing 7 posts - 1 through 7 (of 7 total)
Viewing 7 posts - 1 through 7 (of 7 total)
Similar topics:
Forums › ProRealTime English forum › ProBuilder support › How can I prevent overwriting of existing values?
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
Hi Florian,
Have you tried this instruction at the beginning of your code…?
DefParam DrawOnLastBarOnly=True
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
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…
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.
There is a way… You could store variables in arrays and then use a loop.
here you have an example:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
defparam drawonlastbaronly=true prd = 20 src1 = low //pivots low if src1 > src1[prd] and lowest[prd](src1) > src1[prd] and src1[prd] < lowest[prd](src1)[prd+1] then $pivotlowy[z+1] = src1[prd] $pivotlowx[z+1] = barindex[prd] z = z + 1 endif if islastbarupdate then for i=z downto 0 do drawpoint($pivotlowx[i],$pivotlowy[i],3)coloured("red") next endif return |
Thank you, Iván,
I’ll give it a try. Sounds plausible to me.
greetz,
Florian
Find exclusive trading pro-tools on 