AFL Function Reference - Categorized list of functions
Basic price pattern detection
Composites
Date/Time
- BarIndex -
get zero-based bar number (AFL 2.3)
- BeginValue -
Value of the array at the begin of the range (AFL 2.3)
- Date -
date (AFL 1.1)
- DateNum -
date number (AFL 1.4)
- DateTime -
retrieves encoded date time (AFL 2.3)
- DateTimeConvert -
date/time format conversion (AFL 2.90)
- Day -
day of month (AFL 1.4)
- DayOfWeek -
day of week (AFL 1.4)
- DayOfYear -
get ordinal number of day in a year (AFL 2.4)
- DaysSince1900 -
get number of days since January 1st, 1900 (AFL 3.20)
- EndValue -
value of the array at the end of the selected range (AFL 2.3)
- GetPlaybackDateTime -
get bar replay position date/time (AFL 3.0)
- HOUR -
get current bar's hour (AFL 2.0)
- INTERVAL -
get bar interval (in seconds) (AFL 2.1)
- MINUTE -
get current bar's minute (AFL 2.0)
- MONTH -
month (AFL 1.4)
- NOW -
gets current system date/time (AFL 2.3)
- SECOND -
get current bar's second (AFL 2.0)
- TIMENUM -
get current bar time (AFL 2.0)
- YEAR -
year (AFL 1.4)
Indicators
- AccDist -
accumulation/distribution
- ADX -
average directional movement index (AFL 1.3)
- ATR -
average true range (AFL 1.3)
- BBandBot -
bottom bollinger band
- BBandTop -
top bollinger band
- CCI -
commodity channel index
- Chaikin -
chaikin oscillator
- GetCursorMouseButtons -
get current state of mouse buttons (AFL 2.80)
- GetCursorXPosition -
get current X position of mouse pointer (AFL 2.80)
- GetCursorYPosition -
get current Y position of mouse pointer (AFL 2.80)
- MACD -
moving average convergence/divergence
- MDI -
minus directional movement indicator (-DI) (AFL 1.3)
- MFI -
money flow index
- NVI -
negative volume index
- OBV -
on balance volume
- OSCP -
price oscillator
- OSCV -
volume oscillator
- PDI -
plus directional movement indicator (AFL 1.3)
- PlotText -
write text on the chart (AFL 2.80)
- PVI -
positive volume index
- RequestTimedRefresh -
forces periodical refresh of indicator pane (AFL 2.90)
- RMI -
Relative Momentum Index (AFL 2.1)
- ROC -
percentage rate of change
- RSI -
relative strength index
- RWI -
random walk index
- RWIHI -
random walk index of highs
- RWILO -
random walk index of lows
- SAR -
parabolic stop-and-reverse (AFL 1.3)
- SetBarFillColor -
set bar/candlestick/cloud chart fill color (AFL 3.1)
- SetChartBkColor -
set background color of a chart (AFL 2.80)
- SetChartBkGradientFill -
enables background gradient color fill in indicators (AFL 2.90)
- SIGNAL -
macd signal line
- STOCHD -
stochastic slow %D
- STOCHK -
stochastic slow %K
- TRIX -
triple exponential smoothed price
- ULTIMATE -
ultimate oscillator
Information / Categories
Lowest/Highest
Math functions
- abs -
absolute value
- acos -
arccosine function
- AlmostEqual -
rounding error insensitive comparison (AFL 2.80)
- asin -
arcsine function
- atan -
arc tan
- atan2 -
calculates arctangent of y/x (AFL 2.90)
- ceil -
ceil value
- cos -
cosine
- cosh -
hyperbolic cosine function (AFL 2.80)
- EXP -
exponential function
- FLOOR -
floor value
- FRAC -
fractional part
- INT -
integer part
- LOG -
natural logarithm
- LOG10 -
decimal logarithm
- MAX -
maximum value of two numbers / arrays
- MIN -
minimum value of two numbers / arrays
- PREC -
adjust number of decimal points of floating point number
- ROUND -
round number to nearest integer
- sign -
returns the sign of the number/array (AFL 2.50)
- SIN -
sine function
- sinh -
hyperbolic sine function (AFL 2.80)
- SQRT -
square root
- tan -
tangent function (AFL 1.0)
- tanh -
hyperbolic tangent function (AFL 2.80)
Miscellaneous functions
- #include -
preprocessor include command (AFL 2.2)
- #include_once -
preprocessor include (once) command (AFL 2.70)
- #pragma -
sets AFL pre-processor option (AFL 2.4)
- ClipboardGet -
retrieves current contents of Windows clipboard (AFL 2.60)
- ClipboardSet -
copies the text to the Windows clipboard (AFL 2.6)
- ColorHSB -
specify color using Hue-Saturation-Brightness (AFL 2.80)
- ColorRGB -
specify color using Red-Green-Blue components (AFL 2.80)
- CreateObject -
create COM object (AFL 1.8)
- CreateStaticObject -
create static COM object (AFL 1.8)
- EnableScript -
enable scripting engine
- EnableTextOutput -
enables/disables text output in the Chart Commentary window (AFL 2.2)
- GETEXTRADATA -
get extra data from external data source (AFL 1.9)
- GetPerformanceCounter -
retrieves the current value of the high-resolution performance counter (AFL 2.90)
- GetRTData -
retrieves the real-time data fields (AFL 2.60)
- GetRTDataForeign -
retrieves the real-time data fields (for specified symbol) (AFL 2.80)
- GETSCRIPTOBJECT -
get access to script COM object (AFL 1.8)
- ISEMPTY -
empty value check (AFL 1.5)
- ISFINITE -
check if value is not infinite (AFL 2.3)
- ISNAN -
checks for NaN (not a number) (AFL 2.3)
- ISNULL -
check for Null (empty) value (AFL 2.3)
- ISTRUE -
true value (non-empty and non-zero) check (AFL 1.5)
- NoteGet -
retrieves the text of the note (AFL 2.6)
- NoteSet -
sets text of the note (AFL 2.6)
- NZ -
Null (Null/Nan/Infinity) to zero (AFL 2.3)
- PopupWindow -
display pop-up window (AFL 3.0)
- PREFS -
retrieve preferences settings (AFL 1.4)
- Say -
speaks provided text (AFL 2.90)
- SETBARSREQUIRED -
set number of previous and future bars needed for script/DLL to properly execute (AFL 2.1)
- StaticVarGet -
gets the value of static variable (AFL 2.60)
- StaticVarGetText -
gets the value of static variable as string (AFL 2.60)
- StaticVarRemove -
remove static variable (AFL 2.80)
- StaticVarSet -
sets the value of static variable (AFL 2.60)
- StaticVarSetText -
Sets the value of static string variable. (AFL 2.60)
- STATUS -
get run-time AFL status information (AFL 1.65)
- STUDY -
reference hand-drawn study (AFL 1.5)
- VarGet -
gets the value of dynamic variable (AFL 2.60)
- VarGetText -
gets the text value of dynamic variable (AFL 2.80)
- VarSet -
sets the value of dynamic variable (AFL 2.60)
- VarSetText -
sets dynamic variable of string type (AFL 2.80)
- VERSION -
get version info (AFL 1.9)
- _TRACE -
print text to system debug viewer (AFL 2.4)
Moving averages, summation
- AMA -
adaptive moving average (AFL 1.5)
- AMA2 -
adaptive moving average (AFL 1.5)
- Cum -
cumulative sum
- DEMA -
double exponential moving average (AFL 2.0)
- EMA -
exponential moving average
- MA -
simple moving average
- SUM -
sum data over specified number of bars
- TEMA -
triple exponential moving average (AFL 2.0)
- WILDERS -
Wilder's smoothing (AFL 1.4)
- WMA -
weighted moving average (AFL 2.0)
Statistical functions
- Correlation -
correlation (AFL 1.4)
- LINEARREG -
linear regression end-point (AFL 2.2)
- LINREGINTERCEPT -
(AFL 2.2)
- LINREGSLOPE -
linear regression slope (AFL 1.4)
- Median -
calculate median (middle element) (AFL 2.5)
- mtRandom -
Mersene Twister random number generator (AFL 3.0)
- mtRandomA -
Mersene Twister random number generator (array version) (AFL 3.0)
- Percentile -
calculate percentile (AFL 2.5)
- RANDOM -
random number (AFL 1.9)
- STDERR -
standard error (AFL 1.4)
- STDEV -
standard deviation (AFL 1.4)
- TSF -
time series forecast (AFL 2.2)
String manipulation
- Asc -
get ASCII code of character (AFL 2.80)
- DateTimeToStr -
convert datetime to string (AFL 2.8)
- NumToStr -
convert number to string (AFL 2.5)
- printf -
Print formatted output to the output window. (AFL 2.5)
- StrExtract -
extracts given item (substring) from comma-separated string (AFL 2.4)
- StrFind -
find substring in a string (AFL 2.5)
- StrFormat -
Write formatted output to the string (AFL 2.5)
- StrLeft -
extracts the leftmost part (AFL 2.0)
- StrLen -
string length (AFL 1.5)
- StrMid -
extracts part of the string (AFL 2.0)
- StrReplace -
string replace (AFL 2.90)
- StrRight -
extracts the rightmost part of the string (AFL 2.0)
- StrToDateTime -
convert string to datetime (AFL 2.80)
- StrToLower -
convert to lowercase (AFL 2.80)
- StrToNum -
convert string to number (AFL 2.5)
- StrToUpper -
convert to uppercase (AFL 2.80)
Trading system toolbox
- AlertIf -
trigger alerts (AFL 2.1)
- ApplyStop -
apply built-in stop (AFL 1.7)
- BarsSince -
bars since
- Cross -
crossover check
- EnableRotationalTrading -
Turns on rotational-trading mode of the backtester (AFL 2.5)
- Equity -
calculate single-symbol equity line (AFL 2.0)
- EXREM -
remove excessive signals (AFL 1.5)
- EXREMSPAN -
remove excessive signals spanning given number of bars (AFL 2.0)
- FLIP -
(AFL 1.5)
- GetBacktesterObject -
get the access to backtester object (AFL 2.60)
- GetOption -
gets the value of option in automatic analysis settings (AFL 2.60)
- GetTradingInterface -
retrieves OLE automation object to automatic trading interfac (AFL 2.70)
- HOLD -
hold the alert signal
- IIF -
immediate IF function
- LASTVALUE -
last value of the array
- OPTIMIZE -
define optimization variable (AFL 1.7)
- REF -
reference past/future values of the array
- SetBacktestMode -
Sets working mode of the backtester (AFL 3.0)
- SetCustomBacktestProc -
define custom backtest procedure formula file (AFL 2.70)
- SetFormulaName -
set the name of the formula (AFL 2.5)
- SetOption -
sets options in automatic analysis settings (AFL 2.3)
- SetPositionSize -
set trade size (AFL 2.70)
- SETTRADEDELAYS -
allows to control trade delays applied by the backtester (AFL 2.1)
- VALUEWHEN -
get value of the array when condition met (AFL 1.1)
Exploration / Indicators
- AddColumn -
add numeric exploration column (AFL 1.8)
- AddTextColumn -
add text exploration column (AFL 1.8)
- EncodeColor -
encodes color for indicator title (AFL 2.2)
- GETCHARTID -
get current chart ID (AFL 2.3)
- GetPriceStyle -
get current price chart style (AFL 2.70)
- LineArray -
generate trend-line array (AFL 2.5)
- PARAM -
add user user-definable numeric parameter (AFL 2.3)
- ParamColor -
add user user-definable color parameter (AFL 2.3)
- ParamDate -
add user user-definable date parameter (AFL 2.60)
- ParamField -
creates price field parameter (AFL 2.70)
- ParamList -
creates the parameter that consist of the list of choices (AFL 2.70)
- PARAMSTR -
add user user-definable string parameter (AFL 2.3)
- ParamStyle -
select styles applied to the plot (AFL 2.70)
- ParamTime -
add user user-definable time parameter (AFL 2.60)
- ParamToggle -
create Yes/No parameter (AFL 2.70)
- ParamTrigger -
creates a trigger (button) in the parameter dialog (AFL 2.70)
- PLOT -
plot indicator graph (AFL 1.8)
- PLOTGRID -
Plot horizontal grid line (AFL 2.3)
- PLOTOHLC -
plot custom OHLC chart (AFL 2.2)
- PLOTSHAPES -
plots arrows and other shapes (AFL 2.3)
- PLOTVAPOVERLAY -
plot Volume-At-Price overlay chart (AFL 2.4)
- SELECTEDVALUE -
retrieves value of the array at currently selected date/time point (AFL 2.1)
- SetChartOptions -
set/clear/overwrite defaults for chart pane options (AFL 2.70)
- SetSortColumns -
sets the columns which will be used for sorting in AA window (AFL 2.90)
- WRITEIF -
commentary conditional text output
- WriteVal -
write number or value of the array
- _DEFAULT_NAME -
retrive default name of the plot (AFL 2.70)
- _N -
no text output (AFL 2.1)
- _PARAM_VALUES -
retrieve param values string (AFL 2.70)
- _SECTION_BEGIN -
section begin marker (AFL 2.70)
- _SECTION_END -
section end marker (AFL 2.70)
- _SECTION_NAME -
retrieve current section name (AFL 2.70)
File Input/Output functions
- fclose -
close a file (AFL 2.5)
- fdelete -
deletes a file (AFL 2.70)
- feof -
test for end-of-file (AFL 2.5)
- fgets -
get a string from a file (AFL 2.5)
- fgetstatus -
retrieves file status/properties (AFL 2.90)
- fmkdir -
creates (makes) a directory (AFL 2.70)
- fopen -
open a file (AFL 2.5)
- fputs -
write a string to a file (AFL 2.5)
- frmdir -
removes a directory (AFL 2.70)
Low-level graphics
Referencing other symbol data
- FOREIGN -
access foreign security data (AFL 1.5)
- GETBASEINDEX -
retrieves symbol of relative strength base index (AFL 2.1)
- PLOTFOREIGN -
plot foreign security data (AFL 2.2)
- RELSTRENGTH -
comparative relative strength (AFL 1.3)
- RestorePriceArrays -
restore price arrays to original symbol (AFL 2.5)
- SetForeign -
replace current price arrays with those of foreign security (AFL 2.5)
Time Frame functions
|