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

RE: [amibroker] Is there an easier way?



PureBytes Links

Trading Reference Links

Eugene: take advantage of Boolean logic (in which a condition, when
true, equals 1, and when false, equals zero).

SumPosROCs=C>Ref(C,-16) + C>Ref(C,-17) + C>Ref(C,-18);

Taking these three lookbacks (you expand to what you want), SumPosROCs
will be equal to 3 if all three conditions are true, 2 if only 2 are
true, etc.

Since you said you wanted to assign -1 if the ROC was less, then you
could write

SumROC=C>Ref(C,-16) - C<Ref(,-16) + etc.....

Here you will get +1 if the ROC is positive and -1 if the ROC is
negative (for the first two terms only of course).

Hope this helps.

Ken

-----Original Message-----
From: Eugene [mailto:johngalt1234@xxxxxxxxx] 
Sent: Monday, April 21, 2003 12:04 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Is there an easier way?

I am working with a mutual fund and am trying the following:

iif(close>ref(c,-16),1,iif(c=ref(c,-16),0,-1))

am comparing the close today to the close 16 days earlier and
assigning a +1 if it is greater, 0 if it is equal and -1 if it is lower.

I want to compare todays price with the price 16,17,18,19 and 20 days
earlier. and repeat the same with prices for the preceeding 5 days.
and sum all the values obtained. 

Not being a programmer, I see that I have to write a lot of lines. Is
there a simpler way?

TIA




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/ 





------------------------ Yahoo! Groups Sponsor ---------------------~-->
Make Money Online Auctions! Make $500.00 or We Will Give You Thirty Dollars for Trying!
http://us.click.yahoo.com/yMx78A/fNtFAA/i5gGAA/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/