Problem setting plot color

Questions about MultiCharts and user contributed studies.
chop
Posts: 2
Joined: 18 Sep 2005

Problem setting plot color

Postby chop » 02 Apr 2007

Plots the angle just fine, but really should be doing SetPlotColor
when the angle goes from neg. to pos., i.e. crosses to above zero.

Am I overlooking some (painfully) obvious detail here?
I can't imagine making the code much simpler.

Code: Select all

Inputs:Price(Close);

Vars:Angle(0);

Angle=ArcTangent(Price-Price[1]);

SetPlotColor(1,DarkGray);

If Angle > 0 and Angle[1] < 0 then
SetPlotColor(1,Red);

Plot1(Angle);
Plot2(0);
Example attached
Attachments
AnglePlot.png
(63.4 KiB) Downloaded 539 times

User avatar
Stanley Miller
Posts: 556
Joined: 26 Jul 2005
Has thanked: 3 times

Postby Stanley Miller » 05 Apr 2007

It plot absolutely correctly on your screenshot i.e. it changes the color when the angle goes from neg. to pos.

Neolystic
Posts: 8
Joined: 28 Feb 2007
Contact:

Postby Neolystic » 23 Apr 2007

This may be closer to, but perhaps still not exactly, what you're looking for. The problem with trying to change the color exactly 'at' the zero line is that each section will be one color, so the sections that cross the zero line will be red both above and below the line, or vice versa. I don't know of a way around this.

- Neo

Code: Select all

Inputs:Price(Close);

Vars:Angle(0);

Angle=ArcTangent(Price-Price[1]);

If angle > 0 then SetPlotColor(1,Red) ;
If angle < 0 then SetPlotColor(1,DarkGray);

Plot1(Angle);
Plot2(0);


Return to “MultiCharts”