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

[amibroker] Subject: Re: if then else



PureBytes Links

Trading Reference Links




Struggling with this code.If I wanted to find a stock 
where for each of the past 5 days, the high was lower than the previous 9 
day moving average, how would I code that?  I can't seem to make the 
code work using the Ref(h,-[i])bitThanks
Use in IB the
 <FONT 
face="Times New Roman">
Cond=Sum(H<<FONT 
size=2>MA(C,9<FONT 
size=2>),5)==<FONT 
size=2>5<FONT 
face="Times New Roman">;<FONT face=Verdana 
size=2>
Plot(C,""<FONT 
size=2>,4*Cond+<FONT 
size=2>1,64<FONT face=Verdana 
size=2><FONT 
face="Times New Roman">);<FONT face=Verdana 
size=2>
Plot(MA<FONT 
size=2>(C,9),<FONT 
size=2>"",9<FONT 
size=2>,1<FONT 
face="Times New Roman">);
 
to paint the candles havung this property.
You ask "high was lower than the previous 9 day moving average", ie 
H<MA(C,9<FONT 
size=2>) to be true, ie H<MA(C,<FONT 
size=2>9) ==1
for the last 5 days, ie 1+1+1+1+1=5.
Cond is binary and will be equal to 1, when true and equal to 0 when 
false.
For AA use
 
Cond=Sum(H<<FONT 
size=2>MA(C,9<FONT 
size=2>),5)==<FONT 
size=2>5<FONT 
face="Times New Roman">;
Filter=Cond;
 
DT
 






Yahoo! Groups Sponsor


  ADVERTISEMENT









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 the Yahoo! Terms of Service.



Attachment:
last5.gif

Attachment: Description: "Description: GIF image"