Chart Indicator Colors Don't Update  [SOLVED]

Questions about MultiCharts and user contributed studies.
brunor
Posts: 65
Joined: 11 Feb 2013
Has thanked: 24 times
Been thanked: 6 times

Chart Indicator Colors Don't Update

Postby brunor » 22 Feb 2013

Chart indicator colors don't update in real-time when conditions are met.
Can this be corrected with the plot order?
I appreciate your assistance.
Thanks.
brunor

Code: Select all

{A = function and B = function}

Condition1 = A > A[1] and Average(B,3) <= Average(B,5) ;
If Condition1 then
Plot5(A,"",rgb(0,0,255));

Condition2 = A <= A[1];
If Condition2 then
Plot6(A,"",rgb(0,0,160));

Condition3 = A > A[1] and Average(B,3) > Average(B,5);
If Condition3 then
Plot1(A,"",yellow);

Condition4 = A < A[1] and Average(B,3) < Average(B,5);
If Condition4 then
Plot7(A,"",cyan);

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Chart Indicator Colors Don't Update

Postby TJ » 22 Feb 2013

what you need is an ELSE

eg.

Code: Select all

If Condition1 then
Plot5(A,"",rgb(0,0,255))
ELSE
Plot5(A,"", another color );

brunor
Posts: 65
Joined: 11 Feb 2013
Has thanked: 24 times
Been thanked: 6 times

Re: Chart Indicator Colors Don't Update

Postby brunor » 22 Feb 2013

Thank you for your reply TJ.
I simplified the code by eliminating 1 color.

Code: Select all

Condition1 = A > A[1] and Average(B,3) > Average(B,5) ;
If Condition1 then
Plot1(A,"A UP",yellow);

Condition2 = A < A[1] and Average(B,3) < Average(B,5) ;
If Condition2 then
Plot2(A,"A DOWN",cyan);

If condition1 = false and condition2 = false then
Plot3(A,"NoConditionMet",blue);

brunor
Posts: 65
Joined: 11 Feb 2013
Has thanked: 24 times
Been thanked: 6 times

Re: Chart Indicator Colors Don't Update

Postby brunor » 22 Feb 2013

This code change didn't work. The chart indicators are not refreshing in real-time. This applies to indicators plotted on the price bars and below the plot (using IQ Feed).

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Chart Indicator Colors Don't Update  [SOLVED]

Postby TJ » 22 Feb 2013

This code change didn't work. The chart indicators are not refreshing in real-time. This applies to indicators plotted on the price bars and below the plot (using IQ Feed).
why are you using 3 plots?

brunor
Posts: 65
Joined: 11 Feb 2013
Has thanked: 24 times
Been thanked: 6 times

Re: Chart Indicator Colors Don't Update

Postby brunor » 22 Feb 2013

That is a very good question. I have corrected my error and the indicator
now updates in real-time.

Thank you kindly TJ.

brunor

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Chart Indicator Colors Don't Update

Postby TJ » 22 Feb 2013

you should code the logic this way:

Code: Select all

Condition1 = A > A[1] and Average(B,3) > Average(B,5) ;
Condition2 = A < A[1] and Average(B,3) < Average(B,5) ;

If Condition1 then // A UP
Plot1(A,"A",yellow)
ELSE
If Condition2 then // A DOWN
Plot1(A,"A",cyan)
ELSE // NoConditionMet
Plot1(A,"A",blue);

brunor
Posts: 65
Joined: 11 Feb 2013
Has thanked: 24 times
Been thanked: 6 times

Re: Chart Indicator Colors Don't Update

Postby brunor » 23 Feb 2013

TJ,
I have changed my code as you indicated ... your version is much cleaner.
Thank you once again for your reply and the learning experience.

brunor

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Chart Indicator Colors Don't Update

Postby TJ » 23 Feb 2013

TJ,
I have changed my code as you indicated ... your version is much cleaner.
Thank you once again for your reply and the learning experience.

brunor
You are welcome.

This coding arrangement is not only cleaner, but faster.
Because if condition1 is met, it will not need to perform the rest of the calculations. The time savings could be 30~40%.


Return to “MultiCharts”