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

[amibroker] Learning



PureBytes Links

Trading Reference Links

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/