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
JSParticipant
Senior
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
JSParticipant
Senior
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:
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