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

RE: [amibroker] Help with Simple "IF" statement



PureBytes Links

Trading Reference Links




Hi Arold,
 
Without commenting on the contents of your function itself 
because this function will only ever return 0 in which case you will never get 
any buy signals, but I guess you know that and are experimenting...
 
<FONT color=#800000 
size=2>function 
MyFunction() {    a = <FONT 
color=#ff00ff>0; 
   b = 0<FONT 
size=2>;    <FONT 
color=#800000>if 
( a > b )    {       a = 
1; 
      z = <FONT 
color=#ff00ff>1; 
   }    <FONT 
color=#800000>else<FONT 
color=#000000>    {       b 
= 1; 
      z = <FONT 
color=#ff00ff>0; 
   }    <FONT 
color=#800000>return<FONT 
color=#000000> z; } i = MyFunction(); <FONT 
color=#000000>Buy = ( i == 
1); <FONT 
color=#008000>/*I'm guessing this is what you actually want to do. Did you want 
to compare i with 1? If so then you need to use the == (equals) 
operator.*/ 

Regards,William Peters<A 
href="">www.amitools.com
-----Original Message-----From: Arold [<A 
href="">mailto:arold_ite@xxxxxxxxx]Sent: 
Monday December 15, 2003 9:05 AMTo: amibroker@xxxxxxxxxxxxxxxSubject: 
[amibroker] Help with Simple "IF" statementHi, I am struggling with 
this syntax error.The compiler tells me that there is a syntax error but 
nothing else. I'm thinking that maybe I don't yet fully understand the 
IF statementsyntax?Please help :)Aroldfunction 
MyFunction(){        a = 
0;        b = 
0;        if ( a > b 
)        
{        
        a = 
1;        
        return 
1;        
}        
else        
{        
        b = 
1;        
        return 
0;        }}i = 
MyFunction();Buy = ( i = 1);------------------------ Yahoo! 
Groups Sponsor ---------------------~-->Buy Ink Cartridges or Refill Kits 
for your HP, Epson, Canon or LexmarkPrinter at MyInks.com. Free s/h on 
orders $50 or more to the US & Canada.<A 
href="" 
target=_blank>http://www.c1tracking.com/l.asp?cid=5511<A 
href="" 
target=_blank>http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM---------------------------------------------------------------------~->Send 
BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
suggest@xxxxxxxxxxxxx-----------------------------------------Post 
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx(Web page: <A 
href="" 
target=_blank>http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
group FAQ at: <A 
href="" 
target=_blank>http://groups.yahoo.com/group/amibroker/files/groupfaq.htmlYour 
use of Yahoo! Groups is subject to <A href="" 
target=_blank>http://docs.yahoo.com/info/terms/






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.