--- In [email protected], ronald davis <gxok...@...> wrote:
>
> Above the dotted line, I have pasted an AFL Plot  that works great.
> The aqua plot color changes color correctly when a cross occurs.
> 
> Below the dotted line is an AFL Plot that I would like to have, but it will
> not work.
> 
> I would  be appreciate it  if a code guru would change this plot statement
> so that it still
> 
> changes color, but also changes the style from line to dots.  Ron D
> 
> tXa=Cross(t,a);    aXt=Cross(a,t);
> 
> Plot(yFe50,"a",IIf(tXa,colorRed,IIf(aXt,colorRed,colorAqua)),styleThick);
> ------------------------------------------------------------------------------------
> Plot(yFe50,"a",IIf(tXa,colorRed|styleDots,IIf(aXt,colorWhite|styleDots,colorAqua)),styleThick);
>

The arguments for Plot are:

 Data to plot (Array)
 Title (String)
 Color (Array)
 Style (constant)
 then the optional args

the style cannot vary (ie. it can not be an array of styles, such as what iif 
returns), and it looks like you are confusing colors with chart styles.

Your 'above the line' code works because you are using iif properly to return 
an array of colors.

So the code should be:
Plot( yFe50, "a", iif(tXa,colorRed,iif(aXt,colorWhite,colorAqua)), styleDots );


Now if you want to vary a solid line with a dashed line in the same graph, you 
can use the following trick:

SolidCondition = <conditional that expresses when you want a solid line vs. 
dashed>
Plot( iif( BarIndex() % 2 == 0 OR SolidCondition, yFe50, NULL ), "a", 
iif(tXa,colorRed,iif(aXt,colorWhite,colorAqua)), styleThick );

Basically, it just replaces the value of the line (yFe50) with interleaved 
'NULL' values (which are not drawn) when the condition is false, to simulate a 
dashed line.

HTH
D.





Reply via email to