2 ways to do this, also easier if you change the toggle around a bit
AVERAGES = ParamToggle("AVERAGES ON/OFF","OFF,ON",1);
if(Averages) Plot( MA( P, Periods ),"", COND , Style); // this shows or
removes the plot totally
OR
Plot( IIf(Averages, MA( P, Periods ),Null),"", COND , Style); // this just
makes the plot values the MA or null
--
Cheers
Graham Kav
AFL Writing Service
http://www.aflwriting.com
On 21/02/2008, Mohammed <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I'm trying to set the Properties of moving Averages in the following code.
>
> I would like to use ParamToggle ( On,Off) to show or hide the moving
> Average, But it is not working.
> ----------------------------------------------
>
> UpColor = *colorBrightGreen*;
> DownColor = *colorRed*;
>
> _SECTION_BEGIN
> ("MA50");
> UpColor = ParamColor("Up Color",UpColor );
> DownColor = ParamColor("Down Color",DownColor );
> STYLE = ParamStyle("Style",*styleDots* );
> AVERAGES = ParamToggle("AVERAGES ON/OFF","ON,OFF",0);
> _SECTION_END();
>
> _SECTION_BEGIN
> ("MA");
> P = ParamField("Price field",-1);
> Periods = Param("Periods", 50, 2, 200, 1, 10 );
> COND = IIf( MA(P, Periods ) > Ref( MA(P, Periods ), -1 ), UpColor ,
> DownColor );
> Plot( MA( P, Periods ),"", AVERAGES | COND , Style);
> _SECTION_END();
> -----------------------------------------------
> Any one can help please?
>
> Regards
>