[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: EMA/breakout signals composite indicator



PureBytes Links

Trading Reference Links

--- In amibroker@xxxxxxxxxxxxxxx, "Jose" <josesilva22@xxxx> wrote:
> 
> Please help this newie... :)
> 
> I'm trying to get the code below to display either the EMA with 
price, 
> OR the crossover signals, choice being through the Parameters (Ctrl-
R) 
> function.  It doesn't seem to work here, and it plots both instead.
> 
> Any idea what I'm doing wrong?
> 
> jose '-)
> 
> 
> ---8<-----------------------
> 
> /* Exponential Moving Average v1.0 */
> /* EMA periodicity adapts to low bar count */
> /* josesilva22@xxxx */
> 
> Title = "EMA/breakout signals";  
> 
> pds = Param("EMA periods",21,1,252,1);
> x = Param("Op=1 Hi=2 Lo=3 Cl=4 Vol=5",4,1,5,1);
> shift = 1+Param("EMA vertical shift %",0,-100,100,0.01)/100;
> display = Param("EMA=1, Signals=2",1,1,2,1);
> 
> x = IIf(x==1,O,IIf(x==1,H,IIf(x==1,L,IIf(x==1,V,C))));

In this line you wonder all the time if x==1.
Perhaps you want to do something else...

> prds = IIf(Cum(x!=-101)<pds,Cum(x!=-101),pds);
> EMA1 = AMA(x,2/(prds+1))*shift;
> signals = Cross(x,EMA1)+Cross(EMA1,x)*-1;
> 
> IIf(display=2,
>  Plot(0,"",colorBlue,styleLine),
>  Plot(Close,"",1,128));
> 
> IIf(display=2,
>  Plot(signals,"EMA signals",colorRed,styleLine),
>  Plot(EMA1,"EMA",colorRed,styleLine));
> 
> ---8<-----------------------


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/Lj3uPC/Me7FAA/ySSFAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/