TradingView
e2e4mfck
13 sep 2019 21:48

[e2] Color Gradient Function 

Gold FuturesCOMEX

Beskrivning

20 step red/green gradient function

The color gradient function allow colorize any source in 5% steps.
Define the source, minimum and maximum value (constant or , for example, bb (or any other channel)).

Versionsinformation

Added the bollinger bands on top of rsi to use the bands as the gradient's min and max values.

Added color themes: Red and Green, Red and Blue, Blue and White, Rainbow

Versionsinformation

Color theme code hidden inside the function.
So now you can use the same function to colorize multiple plots and flip (or not) the gradient separately for every function call.
f_col_grad ( source, min_source, max_source, color_theme , color_flip ).

Versionsinformation

- Code clean up

Versionsinformation

Major update:
- Color gradient moved into array
- 3 additional gradients
- Indicator inputs hardcoded
- Code refactor

Versionsinformation

.
Kommentarer
Anderson-FX
Awesome Update !!!! :)
djmad
Thank you, this is looking really really good framework for gradients
scarf
This is dynamite!
LucF
Elegance, simplicity, beauty and power. Love it!
WyckoffMode
Awesome!

; )
e2e4mfck
@WyckoffMode, Thanks )
jsiv95
Hello, Thanks for the contribution!

I have issues with the indicator, my upper chart does not have the gradient colors. Any clues where it could come from ? thanks!
KasikaBoss
@jsiv95, Go to the indicator settings and check ''colorize bars''. Hope that helps.
rimko
Thanks a lot !!!

Just a small thing, if _minSrc == _src then f_colGrad() give "na".

To work around i have modify the line 56 like that:
f_in(_min, _src, _max) => (_min <= _src) and (_src <= _max)
e2e4mfck
@rimko, Hi, thanks for pointing this out! Missed that bug. Your solution will work, but I will try to avoid "double equal" reading even if the first conditional won't trigger the next one.
You can also change the first condition in line 88: "_src < _min" to "_src <= _min" to fix that.
Mer