Page 1 of 1

Tone color when increase

Posted: 08 Dec 2015
by NiC72
Is there any possibility to tone color (like GradientColor) of the plot when I zoom (Increase bar spacing) the chart-window ?

Re: Tone color when increase

Posted: 09 Dec 2015
by SP
You could try something like that:

Code: Select all

vars: barcolor ( 0 );


Switch(getappinfo(aibarspacing)) begin
case < 6: barcolor = red;
case < 8: barcolor = magenta;
case < 10: barcolor = yellow;
case < 15: barcolor = cyan;
case >= 15: barcolor = green;
end;

Plot1 ( 1 , "", barcolor ,barcolor );

Re: Tone color when increase

Posted: 10 Dec 2015
by NiC72
SP , your solution was brilliant!
Tried to get the whole plot to change color , but without success.
The idea was to zoom in and when to see a more sensitive indicator ( hidden in the normal mode ).

Re: Tone color when increase

Posted: 11 Dec 2015
by SP
For changing the color in the past add a loop, i.e.:

Code: Select all




vars: intrabarpersist barcolor ( 0 );

Once barcolor = red;


Switch(getappinfo(aibarspacing)) begin
case < 6: barcolor = red;
case < 8: barcolor = magenta;
case < 10: barcolor = yellow;
case < 15: barcolor = cyan;
case >= 15: barcolor = green;
end;

Plot1 ( RSI (close,14) , "", barcolor ,barcolor );

for value1 = 1 to currentbar
begin
SetPlotColor [value1](1,barcolor);
end;


You only need to add some lines into your code to prevent that the color change is calculated at each tick.

Re: Tone color when increase

Posted: 16 Dec 2015
by NiC72
Thanks SP, you are a star!
Everything works as I wanted.

Code: Select all

Vars: intrabarpersist barcolor(0);

Once barcolor = red;

{------------------ Switch Plot Color ------------------}
Switch(getappinfo(aibarspacing)) begin
case < 0.10: barcolor = white;
case < 0.40: barcolor = magenta;
case < 0.70: barcolor = yellow;
case < 1: barcolor = cyan;
case >= 1: barcolor = green;
end;
{---------------- End Switch Plot Color ---------------}

Plot1 (RSI(close,14),"testRSI",barcolor,barcolor);

{------------------ Set Plot Color --------------------}
if (barColor <> barColor[1]) then
begin
for value1 = 1 to currentbar
begin
SetPlotColor[value1](1,barcolor);
Print("SetPlotColor");
end;
end;
{----------------- End Set Plot Color -----------------}