Custom Indicator-Replace zero values with previous non-zero value

Login or Register

Please login or register in order to view and post in the Forum.

3 posts / 0 new
Last post
Matthew Shanks
Last seen: 2 years 8 months ago
Joined: 07/22/2021 - 17:05
Custom Indicator-Replace zero values with previous non-zero value

I'm using the syntax
(BOLD.1<BOLD AND BOLD.1<BOLD.2)*(BOLD.1);
to plot a pivot level in a bollinger band. The chart works fine if I use the connect all non-zero values option, but I want to reference the value from another indicator without the zero. The end goal is to only change the value of the indicator if a new lower peak is formed.
I've tried to use
(CI=0)*CI.1;
thinking it would replace the zeros with the previous bar's value but no luck
I tried
(CI=0)*CI.1?CI.1:CI;
but still get the same results
Any ideas?

0
cpayne
Last seen: 1 year 7 months ago
Joined: 03/30/2009 - 00:00
Hold Bollinger Value

So you would create and save the following Signal...

(BOLD.1<BOLD AND BOLD.1<BOLD.2)

Then you would create this custom indicator....

REF(BOLD.1, SSTAT)

where SSTAT is setup as "Bars Since Last Signal" (referencing signal we created above).

That should do it..... Here is a chart definition that demonstrates...

https://www.linnsoft.com/charts/cp-bollingerholdvalue-es 

Matthew Shanks
Last seen: 2 years 8 months ago
Joined: 07/22/2021 - 17:05
This is perfect. Thanks

This is perfect.

Thanks