PureBytes Links
Trading Reference Links
|
If by 'statement is false' you mean that nothing is written, try adding Buy
= 1; as the 1st line of the #include.
Bob
-----Original Message-----
From: mmqp [mailto:mmqp@xxxxxxxxx]
Sent: Tuesday, June 17, 2003 10:34 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Re: if-else control statement vs IIF function
Tomasz,
why is this statement is false even I am currently using QPDatabase
if ( GetDatabaseName() == "QPDatabase" ) {
WriteIf(Buy==1 OR Buy == 0,GetExtraData("briefing"),"");
WriteIf(Buy==1 OR Buy == 0,"\nROE = " + WriteVal(GetExtraData("ROE"))
+"%","");
WriteIf(Buy==1 OR Buy == 0,"Annual Dividend = " + WriteVal
(GetExtraData("AnnDividend"))+"%","");
WriteIf(Buy==1 OR Buy == 0,"PEG Ratio = " + WriteVal(GetExtraData
("PEG")),"");
WriteIf(Buy==1 OR Buy == 0,"GPE Ratio = " + WriteVal(1/GetExtraData
("PEG")),"");
WriteIf(Buy==1 OR Buy == 0,"BV per share = $" + WriteVal(GetExtraData
("BookValuePerShare")),"");
//WriteIf(Buy==1 OR Buy == 0,"BV = x" + WriteVal(GetExtraData
("BookValuePerShare"))+" $","");
WriteIf(Buy==1 OR Buy == 0,"PE Range = " + WriteVal(GetExtraData
("LoPERange"),1.2) + " - " + WriteVal(GetExtraData
("HiPERange"),1.2),"");
WriteIf(Buy==1 OR Buy == 0,"SharesShort = "+ WriteVal(GetExtraData
("SharesShort"),1),"");
WriteIf(Buy==1 OR Buy == 0,"SharesFloat = "+ WriteVal(GetExtraData
("SharesFloat"),1),"");
WriteIf(Buy==1 OR Buy == 0,"Shares = "+ WriteVal(GetExtraData
("Shares"),1),"");
WriteIf(Buy==1 OR Buy == 0,"1 Yr EPS Growth = "+ WriteVal(GetExtraData
("Yr1EPSGrowth"))+"%","");
WriteIf(Buy==1 OR Buy == 0,"5 Yr EPS Growth = "+ WriteVal(GetExtraData
("Yr5EPSGrowth"))+"%","");
WriteIf(Buy==1 OR Buy == 0,"1 Yr Proj EPS Growth = "+ WriteVal
(GetExtraData("Yr1ProjEPSGrowth"))+"%","");
WriteIf(Buy==1 OR Buy == 0,"3 to 5 Yr Proj EPS Growth = "+ WriteVal
(GetExtraData("Yr3to5ProjEPSGrowth"))+"%","");
WriteIf(Buy==1 OR Buy == 0,"TTM Sales = "+ WriteVal(GetExtraData
("TTMSales")),"");
WriteIf(Buy==1 OR Buy == 0,"TTM EPS = "+ WriteVal(GetExtraData
("TTMEPS")),"");
WriteIf(Buy==1 OR Buy == 0,"Inst. Holdings = "+ WriteVal(GetExtraData
("InstHolds"),1.1)+"%","");
WriteIf(Buy==1 OR Buy == 0,"LT Debt to Equity = "+ WriteVal
(GetExtraData("LTDebtToEq")),"");
WriteIf(Buy==1 OR Buy == 0,"Cash Flow Per Share = $"+ WriteVal
(GetExtraData("CashFlowPerShare")),"");
WriteIf(Buy==1 OR Buy == 0,"Beta = "+ WriteVal(GetExtraData
("BEta")),"");
WriteIf(Buy==1 OR Buy == 0,"Options = "+ WriteVal(GetExtraData
("HasOptions"),1),"");
WriteIf(Buy==1 OR Buy == 0,"QP2 - RS = " + WriteVal(GetExtraData
("QRS")),"");
}
--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <amibroker@xxxx>
wrote:
> Hello,
>
> It seems that people tend to confuse if-else and IIF. Here is some
more explanation:
>
> if-else is flow control statement. it allows you to change the flow
of the program (skip some parts of the formula)
>
> if( Name() == "MSFT" )
> {
> // the special handling for MSFT
> // this part is executed only for MSFT and skipped for all other
symbols
> Plot( MA( Close, 10 ), "MA10 for Microsoft only", colorGreen );
> }
>
>
> - in this example moving average it plotted ONLY when ticker is
MSFT. The part in curly braces is skipped
> completely if ticker is different.
>
> IIF is a FUNCTION that evaluates all arguments always and just
returns the value of 2nd or 3rd argument
> depending on condition (1st argument). There is no way to skip any
part of the formula using IIF.
>
> Also IIF works on ARRAYS while if is a statement that works on
single TRUE/FALSE value;
>
> IIF in fact can be re-implemented using if-else
>
> function IIFreimplemented( ConditionArray, TrueArray, FalseArray )
> {
> for( i = 0; i < BarCount; i++ )
> {
> if( ConditionArray[ i ] )
> {
> result[ i ] = TrueArray[ i ];
> }
> else
> {
> result[ i ] = FalseArray[ i ];
> }
> }
> }
>
> IIFreimplemented works exactly like built-in IIF.
>
> Best regards,
> Tomasz Janeczko
> amibroker.com
> Best regards,
> Tomasz Janeczko
> amibroker.com
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/
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/Lj3uPC/Me7FAA/ySSFAA/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/
|