WriteIf
|
Exploration / Indicators |
Tomasz Janeczko tj --at-- amibroker.com 2004-06-12 05:56:01 | WriteIf in fact does not "write" anything. The name is misleading but it is left for easy translation of MS formulas to AmiBroker. WriteIf is just "TextIIF" it RETURNS string value depending on condition. In commentary window, statements evaluating to STRINGS on global level are displayed in the output window. However if you do the same inside the FUNCTION it is no longer in global level (it is on LOCAL, FUNCTION level). To display actual string in this case use PRINTF function: http://www.amibroker.com/f?printf function comment(indicator) { printf( "\nComment...\n" ); printf( WriteIf(1, "TrueText", "FalseText") ); printf( WriteVal(indicator) + "\n" ); } |
Tomasz Janeczko 2005-08-10 06:37:55 | Please note that WriteIf returns just single string representing current SelectedValue of the EXPRESSION |
The WriteIf function is used in the following formulas in AFL on-line library:
See updated/extended version on-line.