|
Category
String Functions
Description
Format a string with embedded items
Syntax
Format("string", ...)
Parameters
string - a literal string or string function result
... - any number of comma-separated formulas corresponding to format codes embedded in the format string
Notes
The string parameter can contain one or more embedded Format Specifiers. Each one will correspond to a parameter passed to the function. The corresponding parameter (formula) is evaluated and its result is inserted in the string in place of the format specifier.
An example of this would be Format("5-day ROC {%2}", c / c[5] - 1). The formula returns a fraction such as 0.0264, which {%2} multiplies by 100 and shows as 2.64%.
Use {?} to insert a string within another string. The parameter that corresponds with {?} can be either a literal string or a function that returns a string. You can even write nested Format functions if you can think of a reason to do so.
Numbers holding dates can be formatted with {//}, as in Format("{//}", BarDate). See Output Format Specification.
Example
ScanCol: Format("RSI={#1} ATR={$2}", RSI(14), ATR(14))
This shows something like RSI=68.9 ATR=$1.25. Use {#N} for a number with N decimal places, {$N} for a dollar amount (the $ is added for you), {%N} only for a fraction or ratio that should be shown as a percent (the value is multiplied by 100), and {?} for a string.
|