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

[amibroker] Subject: Re: if then else



PureBytes Links

Trading Reference Links

Thanks DT
so simple if your mind works that way
RO

--- In amibroker@xxxxxxxxxxxxxxx, "Dimitris Tsokakis" <TSOKAKIS@xxxx> 
wrote:
> 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])
> bit
> 
> Thanks
> 
> Use in IB the
> 
> Cond=Sum(H<MA(C,9),5)==5;
> Plot(C,"",4*Cond+1,64);
> Plot(MA(C,9),"",9,1);
> 
> to paint the candles havung this property.
> You ask "high was lower than the previous 9 day moving average", ie 
H<MA(C,9) to be true, ie H<MA(C,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<MA(C,9),5)==5;
> Filter=Cond;
> 
> DT


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get a FREE REFINANCE QUOTE - click here!
http://us.click.yahoo.com/2CXtTB/ca0FAA/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/