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

[amibroker] Re: Learning



PureBytes Links

Trading Reference Links

Hi sjsolak.

Im not sure of what yopu want but this formula places all the 
positive ROC in 1 column and the negative ROC in another column.

 It also has 2 other column, 1 has the last time the positive ROC was 
true,and the other contains the last time the negative ROC was true.  


 Run it as an exploration.


CRoc = ROC(C,1);
PosRoc = IIf (CRoc >= 0, CRoc, prevCRoc);
NegRoc = IIf (CRoc < 0, CRoc, prevCRoc);
barnumberpos = Cum(PosRoc);
lastbarpos = barnumberpos == LastValue( barnumberpos );
lastbarpos =Cross(Lastbarpos,0.1);

barnumberneg = Cum(NegRoc );
lastbarneg = barnumberneg == LastValue( barnumberneg );
lastbarneg =Cross(Lastbarneg,0.1);

Filter = Croc;//1;

AddColumn(Ref(C,-1),"yesterdaysclose today");
AddColumn(C,"close today");
AddColumn(CRoc,"ROC");
AddColumn(PosRoc,"P Col");
AddColumn(NegRoc,"N Col");
AddColumn(Lastbarpos,"Lastpos");
AddColumn(Lastbarneg,"Lastneg");




Peter.



--- In amibroker@xxxxxxxxxxxxxxx, "sjsolak" <sjsolak@xxxx> wrote:
> I am still trying learn Amibroker.  I have a question.  I am OK 
with 
> Excel so I can explain my question using an Excel example.
> 
> Col A is the ROC for the Close (of SPX in my test)
> 
> I want Col B to be the ROC if the Close ROC is postive and the last 
> postive value if the new ROC is negative.
> 
> I want Col C to be the ROC if the Close ROC is negative and the 
last 
> negative value if the new ROC is postive.
> 
> Will someone please help?  Here is the code I have, but willing to 
> start over.  This gives values for the prevCRoc and I don't want 
that 
> value.
> 
> In Excel it is (B1) =If(a1>=0,a1,b2)
>                (C1) =If (a1<0,a1,c2)   
> 
> AmiBroker Test:
> 
> CRoc = ROC(C,1);
> prevCRoc = Ref(CRoc,-1);
> 
> PosRoc = IIf (CRoc >= 0, CRoc, prevCRoc);
> NegRoc = IIf (CRoc < 0, CRoc, prevCRoc);
>  
> Filter = Close >1;
>  
> AddColumn(C,"close today");
> AddColumn(CRoc,"ROC");
> AddColumn(PosRoc,"P Col");
> AddColumn(NegRoc,"N Col");
> 
> 
> // Not sure below is correct.   Why do you need Buy and Sell for 
> Explore?
> Buy = Cross( Close, EMA( Close, 45 ) );
> Sell = Cross( EMA( Close, 45 ), Close );
> 
> Stan Solak


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/O10svD/Me7FAA/AG3JAA/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/