Formula Language
Previous Top Next

  
Functions
Descriptions
@SETNAME(Name)
Set formula line name. Should be start with @.
@SETNAME(Data,Name)
Set formula line name. Should be start with @.
@SETTEXTVISIBLE(Visible)
Set formula line name visibility. should be start with @.
@SET_ATTRIBUTE(Data, Attr)
Set attribute of the formula. Should be start with @.
@SETYMINMAX(MinY,MaxY)
Set min and max value of Y-axis. Should be start with @.
@SETCOLORSCRIPT(Data,Name,Script)
Set customize color for Data based on Script. Should be start with @.
@COPYNUMERICATTR(Data1,Data2)
Copy numerical attribute from Data1 to Data2. Should be start with @.
@COPYMISCATTR(Data1,Data2)
Copy miscellenous attribute from Data1 to Data2. Should be start with @.
@GETNUMERICATTR(Data,Index)
Get numerical attribute from Data. Should be start with @.
@SETNUMERICATTR(Data1,Index,Data2)
Set Data2 as numerical attribute of Data1. Should be start with @.
CLONE(Data)
Clone another copy of data.
TRUE
True constant.
FALSE
False constant.
NAN
An array of nan.

  
Basic Data
Descriptions
CLOSE
Get the counter's close price.
C
Shortcut of CLOSE.
OPEN
Get the counter's open price.
O
Shortcut of OPEN.
HIGH
Get the counter's highest price.
H
Shortcut of HIGH.
LOW
Get the counter's lowest price.
L
Shortcut of LOW.
VOLUME
Get the counter's volume.
VOL
Shortcut of VOLUME.
V
Shortcut of VOLUME.
OPENINTEREST
Open Interest.

  
Reference Functions
Descriptions
MUL(Data)
Multiple from the first bar.
SUM(Data,N)
Sum last N days value.
SUM(Data)
Sum from the first bar.
COUNT(Data,N)
True count of last N days.
REF(Data,N)
Reference value of N days before.
REF_EXPAND(Data,N)
Reference value of N days before. (Extend into future data)
MA(N)
N days moving average of Close price.
MA(Data,N)
N days moving average.
MA(Price,N)
N days moving average.
EMA(Data,N)
N days exponential moving average.
EMA(Price,N)
N days exponential moving average.
WMA(Data,N)
N days weighted moving average.
WMA(Price,N)
N days weighted moving average.
SMA(Data,N,M)
M days simple moving average from Nth day onwards
WILDERSUM(Data,N)
Wilder summation.
HHV(Data,N)
N days highest value.
LLV(Data,N)
N days lowest value.
HHVBARS(Data,N)
N days highest value bars count.
LLVBARS(Data,N)
N days lowest value bars count.
BARSCOUNT(Data)
Bars count.
BARSSINCE(Data)
Bars count since first Data > 0.
BACKSET(Data,N)
Backset N bars to 1 when Data > 0.
VOLUMEOVERPRICE(N)
Volume over price.

  
Logic Functions
Descriptions
IF(Cond,Data1,Data2)
If Cond > 0 return Data1, otherwise return Data2.
IF_PREV(Cond,Data1,Data2)
If Cond > 0 return Data1, otherwise return Data2 + prev Data.
REPLACE(Cond1,Cond2,Data)
If Cond1 == Cond2, replace with Data.
CROSS(Data1,Data2,N)
If Data1 cross Data2 from below and the cross last N bars return 1, otherwise return 0.
Above(Data1,Data2,N)
If Data1 is above Data2 for last N bars return 1, otherwise return 0.
Below(Data1,Data2,N)
If Data1 is below Data2 for last N bars return 1, otherwise return 0

  
Math Functions
Descriptions
MAX(Data1,Data2)
Maximum value.
MIN(Data1,Data2)
Minimum value.
ABS(Data)
Absolute value.
LOG(Data)
10 based Log.
LOG(Data,N)
N based Log.
LOG10(Data)
10 based Log.
LN(Data)
e based Log.
EXP(Data)
e raised to the specified power.
SQRT(Data)
Square root of the value.
SQR(Data)
Square of the value.
ROUND(Data)
Round value to nearest whole number.
FLOOR(Data)
Round down value to nearest whole number.
CEIL(Data)
Round up value to nearest whole number.

  
Statistic Functions
Descriptions
STD(Data,N)
N days standard deviation value.
VAR(Data,N)
N days variant value.
AVEDEV(Data,N)
N days average value.
SLOPE(Data,N)
N days linear regression slope.
CORR(Data1,Data2,N)
N days correlation factor between Data1 and Data2.
RECUSIVE_LOOP(Data1,N,M,Data2)
Recursive calculate next item value according to previous item value.
RECUSIVE_LOOP(Data1,N,M,Data2,F)
Recursive calculate next item value according to previous item value.

  
Index Functions
Descriptions
ZIG(Data,N)
N days Zig Zag.
ZIG(Data,Data2,N)
N days Zig Zag percent value.
PEAK(Data,Data2,N,M)
Find Mth Peak based on Zig(N)
TROUGH(Data,Data2,N,M)
Find Mth Trough based on Zig(N)
FINDPEAK(Data,Data2,N)
Find Peak based on Zig(N).
FINDTROUGH(Data,Data2,N)
Find Trough based on Zig(N).
SAR(N,STEP,MAXP)
Parabolic Stop and Reversal.
VALUEWHEN(Cond,Data,N)
Find Nth most recent occurrences when Cond is True
VALUEWHENBARS(Cond,Data,N)
Find bar count of Nth most recent occurrences when Cond is True
LOWESTSINCE(Cond,Data,N)
Return lowest of Data if Cond > 0 on Nth most recent occurrences.
HIGHESTSINCE(Cond,Data,N)
Return highest of Data if Cond > 0 on Nth most recent occurrences.

  
String Functions
Descriptions
CODE
Return counter's symbol.
STKLABEL
Return counter's symbol.
SYMBOL
Return counter's symbol.
STOCKNAME
Return counter's name.
STOCKNAME(Data)
Return Data's name.
STKNAME
Return counter's name.
STKNAME(Data)
Return Data's name.

  
Draw Functions
Descriptions
DRAWSIGNAL(Cond, Pos, Signal)
Draw buy/sell arrow at position when Cond is True.
FILLRGN(Cond,Data1,Data2)
Fill region Data1 to Data2 when Cond is True.
FILLAREA(Data)
Fill area below Data.
PIVOTSEGMENT(Period,N,Data,M)
Render pivot segment.
PIVOTSEGMENT(Period,N,Data,M,L)
Render defined number of sets of pivot segment
STOCK
Draw counter bar based on O, C, H, L.

  
Advanced Functions
Descriptions
FML(FormulaScript)
Reference other formula.
FML(Symbol,FormulaScript)
Reference other formula.
FML(Symbol,FormulaName,Params)
Reference other formula.
GETDATA(Period,N,Data)
Get price data in defined period
MERGEDATA(Period,N,Data)
Merge data in defined period

  
Data Attributes
Descriptions
THIS_DATA
Refer to current formula data.
COLORSTICK
Render data as histogram.
VOLSTICK
Render data as volume histogram.
SEGMENT_LINE
Add segment line.
HORZLINE
Add horizontal line.
VERTLINE
Add vertical line.
NOVALUELABEL
Do not show value label.
VALUEONLY
Show value label only.
WIDTH
Set line width.
FORMAT
Set display string format to number of precision or decimal
HIGHSPEED
Smooth line with no anti-aliasing.
ANTIALIAS
Smooth line with anti-aliasing.
DASHDASH
Render dash dash line.
DOTDASH
Render dot dash line.
DASHDOTDASH
Render dash dot dash line.
DASHDOTDOTDASH
Render dash dot dot dash line.
CROSSDOT
Render cross dot line.
POINTDOT
Render point dot line.
CIRCLEDOT
Render circle dot line.



See Also:
Create/Edit Formula