View Full Version : Colouring the indicator

Bhavani Deshpande
11-26-2015, 05:52 AM

Can we change the colour of the trix indicator in the code? If yes, please let me know how to do it?

11-26-2015, 07:44 AM

yes you can , by using LineColor (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/2338) method

for example

Const COLOR_RED = 255
Dim m_indR3
Dim arrR3()

Public Sub main()
m_indR3 = AddCustomIndicator(0, arrR3, 1, False)
LineColor 0, CStr(m_indR3), COLOR_RED
End Sub

Bhavani Deshpande
12-01-2015, 11:08 AM
Thanks a lot. Can we give multiple colors for the same indicator?
For example, we give a color when the line moves to the lower position and a different color when it moves to a higher position?

12-03-2015, 11:42 AM

I'm sorry for the previous email , and sure you can by save the lower position on array and the higher position on other array then use addCustomIndicater (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/2662) and LineColor (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/2338) .such as the below example check it and let me know if you need any things .

Dim arrOpen(), arrHigh(), arrLow()
Dim m_indID1, m_indID2
Const UNDEFINED = -987654321
Const COLOR_BLUE = 16711680 ' Blue
Const COLOR_RED = 255 'red

Public Sub main()
''''TODO: Script program start method

ReDim arrHigh(BARS_COUNT+1)
ReDim arrLow(BARS_COUNT+1)
CopyOpen 0, 1, Bars(0),arrOpen
CopyOpen 0, 1, Bars(0),arrHigh
CopyOpen 0, 1, Bars(0),arrLow
For i = 1 To CLng(Bars(0))
arrHigh(i) = UNDEFINED
arrLow(i) = UNDEFINED
For i = 1 To BARS_COUNT-1
if arrOpen(i) <= arrOpen(i+1) then
arrHigh(i) = arrOpen(i)
arrLow(i) = arrOpen(i)
end if
m_indID1 = AddCustomIndicator(0, arrLow, 1, False)
SetSeriesStyle 0, CStr(m_indID1), LINE_CHART
LineColor 0, CStr(m_indID1), COLOR_RED
LineWeight 0, CStr(m_indID1), 3
m_indID2 = AddCustomIndicator(0, arrHigh, 1, False)
SetSeriesStyle 0, CStr(m_indID2), LINE_CHART
LineColor 0, CStr(m_indID2), COLOR_BLUE
LineWeight 0, CStr(m_indID2), 3

End Sub