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

[amibroker] 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])
bit

Thanks
--- In amibroker@xxxxxxxxxxxxxxx, "amiabilityy" <amiabilityy@xxxx> 
wrote:
>  Hi 
> 
> This seems to work, I assume you only wanted this as a simple test 
> to figure out how to use if then else.
> 
> 
> Aa=DayOfWeek();
> for( i = 0; i < BarCount; i++ ) 
> 
>  { 
>  if  ( Aa[ i ]==1)
>        bb[ i ] = 1000;
>    else
>        bb[ i ] = 0;
> }
> 
>  
> Buy=Filter=1;
> AddColumn(Aa,"datenumber");
> AddColumn(bb,"mydate");
> 
> 
> The value of 1000 is  just to make it more obvious, for testing  
when 
> running an exploration.
> 
> 
> 
> Peter.
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "kk12338" <kk2628@xxxx> wrote:
> > Hi,
> > 
> > The following code still return 1 to tday irregardless DayofWeek 
> cud 
> > be 2 or 3 or 4 or 5, is my coding wrong ?
> > 
> > if (dayofweek()==1)
> > tday=1;
> > else
> > tday=0;
> > 
> > Thanks
> > KK


------------------------ 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/