RGB(Red, Green, Blue) as Color

RGB function returns a color that can be used with SetBarColor or SetIndicColor. It is used to render a custom color from Red, Green and Blue composites.
This function has three parameters:
Red   Enter the weight of Red in the final color. The range goes from 0 to 255!
Green   Enter the weight of Green in the final color. The range goes from 0 to 255!
Blue   Enter the weight of Blue in the final color. The range goes from 0 to 255!

 

Example:

' Test Color system
' To see a result, apply it on a graph!
' You can run it but it will return nothing cause there are no buy/sell signals
Sub Main()
  For CurrentBar = BeginBar to EndBar
    If GetValue("SAR", CurrentBar) < Close(CurrentBar) then SetBarColor CurrentBar, RGB(120, 3, 52)
    If GetValue("SAR", CurrentBar) > Close(CurrentBar) then SetBarColor CurrentBar, RGB(20, 36, 87)
    If GetValue("RSI", CurrentBar) < 20 then SetBarColor CurrentBar, RGB(0, 255, 10)
  Next
End Sub