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

[amibroker] Re: Syntax Question



PureBytes Links

Trading Reference Links

> -----Original Message-----
> From: Sam Levy [mailto:slevy1220@x...]
> Sent: Monday, May 05, 2003 8:48 AM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Syntax Question
> 
> 
> Is the following correct?:
> 
> If I want a buy signal if both of two conditions are true, I would
> code:
> 
> buy=cond1 and cond2;
> 
> If I want a buy signal if either is true, I would code:
> 
> buy=cond1 or cond2;
> 
> What is the difference between those and:
> 
> buy=cond1;
> buy=cond2;

The main difference is that 
buy=cond1 or cond2;
is one-line code  and
buy=cond1;
buy=cond2;
is two-line code.
AFL is executed line by line.
So, in the second case you ask

buy=cond1;// buy when cond1 is true
buy=cond2;// buy when cond2 is true
AFL will go to the next statement with the last info : buy=cond2;
Sometimes, this property is useful :

D=5;
M=MA(H,D);
PLOT(M,"",1,1);
D=10;
M=MA(H,D);
PLOT(M,"",2,1);
D=15;
M=MA(H,D);
PLOT(M,"",3,1);
will plot 3 different MAs, although only one is defined, namely M.
On the other side the

D=5;
M=MA(H,D);
D=10;
M=MA(H,D);
D=15;
M=MA(H,D);
PLOT(M,"",1,1);
PLOT(M,"",2,1);
PLOT(M,"",3,1);
will plot 3 MAs identical to MA(H,15)
Dimitris Tsokakis






> I would be grateful if someone would set me straight on this.
> 
> 
>       Yahoo! Groups Sponsor
> 
> 
> 
> 
> 
> Send BUG REPORTS to bugs@xxxx
> Send SUGGESTIONS to suggest@xxxx
> -----------------------------------------
> 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.


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Rent DVDs from home.
Over 14,500 titles. Free Shipping
& No Late Fees. Try Netflix for FREE!
http://us.click.yahoo.com/BVVfoB/hP.FAA/uetFAA/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/