Joris,
I must admit that I do not understand what it is you are trying to do.
But, it would seem that, as a minimum, you should pull all your array
calculations out of the loop. The next question is; Why have you got a
loop at all? Wouldn't a single call to each of the Plot statements be
enough? What do you gain by calling the identical plot statements
multiple times?
Title = EncodeColor(4)+ _DEFAULT_NAME()+"; "+EncodeColor(1) +
StrFormat("{{NAME}} - {{INTERVAL}}; {{DATE}}; O=%g, H=%g, L=%g, C=%g
(%.1f%%)
{{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) );
EMABarsVisible89= Param("EMABarsVisible89",89,5,200,1);//for demo
purposes
EMABarsVisible55=Param("EMABarsVisible55",55,5,200,1);//for demo
purposes
EMABarsVisible34=Param("EMABarsVisible34",34,5,200,1);//for demo
purposes
EMABarsVisible21=Param("EMABarsVisible21",21,5,200,1);
UpperLimit=Param("UpperLimit",2,2,1000,100); //changed values
Plot(C,"C",1,64);
Indices = BarIndex();
EMA89 = EMA( C,EMABarsVisible89);
EMA55 = EMA( C,EMABarsVisible55);
EMA34 = EMA( C,EMABarsVisible34);
EMA21 = EMA( C,EMABarsVisible21);
// for(i=1;i< UpperLimit;i++)
{
Plot( IIf( Indices >= BarCount - EMABarsVisible89, EMA89, Null ), "",
5,styleNoLabel |5 );//For verification replace once "" by "EMA55"
Plot( IIf( Indices >= BarCount - EMABarsVisible55, EMA55, Null ), "",
4,styleNoLabel |5 );
Plot( IIf( Indices >= BarCount - EMABarsVisible34, EMA34, Null ),
"",6 ,styleNoLabel |5 );
Plot( IIf( Indices >= BarCount - EMABarsVisible21, EMA21, Null ), "",
colorViolet,styleNoLabel |5 );
}
Mike
--- In [email protected], "Joris Schuller" <jschul...@...>
wrote:
>
> Some additional thoughts.
>
> 1. There must be a simpler solution, but I haven't seen it yet: None
of the
> proposed/suggested or implemented solutions work. After a few seconds
the
> undesired line segments are displayed again. So in the absence of
something
> more elegant you have to live with this one.
>
> 2. Essentially all you try to do is refresh fast enough such that the
> unwanted line segments are suppressed (incidentally, You can
accomplish the
> same by renting a monkey and let him/her hit the "apply indicator"
arrow in
> the Formula Editor. I have tested this too and concluded that afl
> performance is not gender-sensitive. The males are slightly smarter
(or
> lazier) and typically hire a female to do the job. (Often the females
are
> content to be paid in units of sex).
>
> 3. Since I didn't know what the monkey supply situation in your region
is, I
> did some additional testing on the afl.
>
> The procedure has a hysteresis effect. If necessary, by increasing the
> UpperLimit value at a given time interval you can suppress the line
> segments, but the system is very sluggish. However subsequent reset to
the
> default value (2) restores responsiveness, while still suppressing the
> segments.
>
>
>
> The best/simplest procedure is:
>
> a. Select lowest time frame of interest; if there is successful
suppression,
> you are done (typically 1 HR timeframe or longer).
>
> b. If not successful, select parameter box and increase UpperLimit
value
> until segments are suppressed. (At the lowest timeframes,2-5 minutes,
I had
> to go to 500-600 and wait 10 seconds or more (it can be sluggish)until
> segments are suppressed.
>
> c. Next click Reset All button (resets UpperLimit value to 2). This
can be
> sluggish too: However, after reset the System becomes responsive
again.
>
> 4. From here on the afl works fine on this and all higher timeframes.
>
> IF YOU HIT THE APPLY INDICATOR BUTTON IN THE FORMULA EDITOR, YOU HAVE
TO
> REPEAT THE PROCEDURE.
>
> 5. At the 1 minute timeframe I get Access Violation errors
Address:00445C7C.
>
> 6. I have no idea why there is a hysteresis and why I can afterwards
> successfully reset to the initial default value.
>
> 7. Similarly, I don't understand why there are Access Violations at
the
> lowest (1 Min) timeframe.
>
>
>
> Title = EncodeColor(4)+ _DEFAULT_NAME()+"; "+EncodeColor(1) +
> StrFormat("{{NAME}} - {{INTERVAL}}; {{DATE}}; O=%g, H=%g, L=%g, C=%g
> (%.1f%%)
> {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) );
>
> EMABarsVisible89=Param("EMABarsVisible89",89,5,200,1);//for demo
purposes
> EMABarsVisible55=Param("EMABarsVisible55",55,5,200,1);//for demo
purposes
> EMABarsVisible34=Param("EMABarsVisible34",34,5,200,1);//for demo
purposes
> EMABarsVisible21=Param("EMABarsVisible21",21,5,200,1);
> UpperLimit=Param("UpperLimit",2,2,1000,100); //changed values
> Plot(C,"C",1,64);
> for(i=1;i< UpperLimit;i++)
> {
> Plot( IIf( BarIndex() >= BarCount - EMABarsVisible89, EMA( C,89), Null
),
> "", 5,styleNoLabel |5 );//For verification replace once "" by "EMA55"
> Plot( IIf( BarIndex() >= BarCount - EMABarsVisible55, EMA( C,55), Null
),
> "", 4,styleNoLabel |5 );
> Plot( IIf( BarIndex() >= BarCount - EMABarsVisible34, EMA( C,34), Null
),
> "",6 ,styleNoLabel |5 );
> Plot( IIf( BarIndex() >= BarCount - EMABarsVisible21, EMA( C,21), Null
),
> "", colorViolet,styleNoLabel |5 );
> }
>
> From: [email protected] [mailto:[email protected]] On
Behalf
> Of Joris Schuller
> Sent: Wednesday, April 21, 2010 9:55 AM
> To: [email protected]
> Subject: RE: [amibroker] Re: Restricted Plot
>
>
>
>
>
>
> Comments:
> 1. Performance can get sluggish at the lowest timeframes
>
> 2. UpperLimit setting Has to increase with Lower time Intervals
> 3. As a result at the Lowest timeframe (1 Minute) you might get an
> accessviolation Code
> 4. Don't forget to reset the Parameter window if you edit the values
>
> Title = EncodeColor(4)+ _DEFAULT_NAME()+"; "+EncodeColor(1) +
> StrFormat("{{NAME}} - {{INTERVAL}}; {{DATE}}; O=%g, H=%g, L=%g, C=%g
> (%.1f%%)
> {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) );
>
> EMABarsVisible89=Param("EMABarsVisible89",89,5,200,1);//for demo
purposes
> EMABarsVisible55=Param("EMABarsVisible55",55,5,200,1);//for demo
purposes
> EMABarsVisible34=Param("EMABarsVisible34",34,5,200,1);//for demo
purposes
> EMABarsVisible21=Param("EMABarsVisible21",21,5,200,1);
> UpperLimit=Param("UpperLimit",555,2,10000,1);
> Plot(C,"C",1,64);
> for(i=1;i< UpperLimit;i++)
> {
> Plot( IIf( BarIndex() >= BarCount - EMABarsVisible89, EMA( C,89), Null
),
> "", 5,styleNoLabel |5 );
> Plot( IIf( BarIndex() >= BarCount - EMABarsVisible55, EMA( C,55), Null
),
> "", 4,styleNoLabel |5 );
> Plot( IIf( BarIndex() >= BarCount - EMABarsVisible34, EMA( C,34), Null
),
> "",6 ,styleNoLabel |5 );
> Plot( IIf( BarIndex() >= BarCount - EMABarsVisible21, EMA( C,21), Null
),
> "", colorViolet,styleNoLabel |5 );
> }
> //Plot(EMA(C,55),"EMA55",4,5);//Use once only for verification that
plots
> provide correct value
>
> From: [email protected] [mailto:[email protected]] On
Behalf
> Of war_maniac2002
> Sent: Wednesday, April 21, 2010 5:45 AM
> To: [email protected]
> Subject: [amibroker] Re: Restricted Plot
>
>
>
>
>
> Try this-
>
> _SECTION_BEGIN("Price");
> SetChartOptions(0,chartShowArrows|chartShowDates);
> _N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g,
Lo
> %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C,
1 ) )
> ));
> Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle |
> ParamStyle("Style") | GetPriceStyle() );
> _SECTION_END();
>
> _SECTION_BEGIN("temp");
>
> for(i=0;i<BarCount;i++)
> {Plot( IIf( BarIndex()>=BarCount -21, EMA( C, 21), Null ), "ema",
> colorRed,styleLine);}
>
> _SECTION_END()
>
> --- In [email protected] <mailto:amibroker%40yahoogroups.com>
,
> "osp2osp" osp2osp@ wrote:
> >
> > How to plot 21 days EMA only for the last 21 bars.
> >
> > Thank you.
> >
> > Warm Regards.
> >
> > K Karunakaran
> >
>