| Easy financial chart - Formula script language guide |
|
1.Below table shows all basic method supported by formula script language. 2.Show line name before ":" . For example DIFF:C-O , formula line DIFF will show in the chart. 3.Don't show line name before ":=". For example A:=(C+O)/2, formula line A will not show in the chart.It's a intermedial variant. 4.Formula line seperate by ";". 100+ basic method can be used in formula script language. |
| Method Name | Method description | Example |
| OPEN/CLOSE/HIGH/LOW/VOLUME/AMOUNT | ||
| CLOSE | Get the stock closing prices | CLOSE |
| OPEN | Get the stock open prices | OPEN |
| HIGH | Get the stock highest prices | HIGH |
| LOW | Get the stock lowest prices | LOW |
| VOLUME | Get the stock volume | VOLUME |
| AMOUNT | Get the stock amount | AMOUNT |
| C | Shortcut of CLOSE | C |
| O | Shortcut of OPEN | O |
| H | Shortcut of HIGH | H |
| L | Shortcut of LOW | L |
| V | Shortcut of VOLUME | V |
| VOL | Shortcut of VOLUME | VOL |
| Other basic data | ||
| DATACOUNT | Data count of current data array | DATACOUNT |
| Date & time functions | ||
| DATE | This returns the date of format yymmdd , yy means the real year minus 1970,mm means month, dd means day. | DATE |
| DAY | This returns the day of the month. | DAY |
| HOUR | This return the hour of the day. | HOUR |
| MINUTE | This return the minute of the hour | MINUTE |
| MONTH | This returns the month of the year.If today was July 15,2003, this function would return 7. | MONTH |
| TIME | Return the time of format hhmmss, which hh is hour , mm is minute , ss is second. | TIME |
| WEEK | Return the week of the year. | WEEK |
| WEEKDAY | This returns an number equal to the day of the week. | WEEKDAY |
| YEAR | This function will return the value of the year. | YEAR |
| Reference functions | ||
| SUM(Data Array,N) | This function totals the values for Data Array over the last N number of records. | SUM(C,10) |
| COUNT(Data Array,N) | COUNT(C>O,10) | |
| REF(DataArray,N) | This returns the value of Data Array on a previous or subsequent period.The time to be accessed is expressed by N. | REF(C,1) |
| MA(DataArray,N) | N days moving average line. | MA(C,10) |
| EMA(DataArray,N) | N days exp moving average line. | EMA(C,10) |
| SMA(DataArray,N) | N days simple moving average line. | SMA(C,10) |
| DMA(Data Array,N) | N days dynamic moving average line. | DMA(C,10) |
| HHV(DataArray,N) | Calculates the highest value of the Data array from the most recent N number of records. | HHV(C,10) |
| LLV(DataArray,N) | Calculates the lowest value of the Data array from the most recent N number of records. | LLV(REF(C,1),10) |
| HHVBARS(DataArray,N) | Looks at the last N number of records in Data Array. This function then returns how many periods have passed since the highest value of those records examined.Remember that this function always includes the current period in its calculations. | HHVBARS(C,10) |
| LLVBARS(DataArray,N) | Looks at the last N number of records in Data Array. This function then returns how many periods have passed since the lowest value of those records examined.Remember that this function always includes the current period in its calculations. | LLVBARS(C,10) |
| BARSCOUNT(DataArray) | BARSCOUNT(C,10) | |
| SUMBARS(DataArray,N) | SUMBARS(C,10) | |
| BARSLAST(DataArray) | BARSLAST(C) | |
| BARSSINCE(DataArray) | BARSSINCE(C) | |
| BACKSET(DataArray,N) | BACKSET(C,10) | |
| FILTER(DataArray,N) | FILTER(C,10) | |
| Logic functions | ||
| IF(Condition,True DataArray,False DataArray) | This is the basic decision making function. If Condition is tree, the result is whatever is in the True Data Array position. Otherwise it returns what is in the False Data Array position. | IF(C>O,H,L) // if Close>Open return High otherwise return Low |
| BETWEEN(DataArray1, DataArray2,DataArray3) |
BETWEEN(C-O,2,3) | |
| RANGE(DataArray1,DataArray2, DataArray3) |
RANGE(C-O,1,2) | |
| CROSS(DataArray1,DataArray2) | CROSS(MA(C,5),MA(C,10)) | |
| LONGCROSS(DataArray1,DataArray2,N) | LONGCROSS(MA(C,10),MA(C,20),10) | |
| NOT(DataArray) | NOT(C>O) | |
| ISLASTBAR(DataArray) | ISLASTBAR(C) | |
| EXIST(DataArray,N) | EXIST(C>O,N) | |
| EVERY(DataArray,N) | EVERY(C,N) | |
| LAST(DataArray,N) | LAST(C,10) | |
| ISUP | Return 1 if C>O , Otherwise 0. | ISUP |
| ISDOWN | Return 1 if C<O , Otherwise 0. | ISDOWN |
| ISEQUAL | Return 1 if C==O , Otherwise 0. | ISEQUAL |
| Math functions 1 | ||
| MAX(DataArray1,DataArray2) | This examines both values inserted for the Data Array and returns which ever of the two has the largest numerical value. | MAX(H-C,C-L) |
| MIN(DataArray1,DataArray2) | This examines both values inserted for the Data Array and returns which ever of the two has the smallest numerical value. | MIN(C-L,H-C) |
| ABS(DataArray) | This function returns the absolute value of the specified data array. The absolute value is equal to the value of the number without any positive or negative sign. | ABC(O-C) |
| FLOOR(DataArray) | The Floor function returns the highest integer that is lower that the smallest value in the data array. | FLOOR(C/O*1000) |
| CEILING(DataArray) | The Ceiling function returns the lowest integer that is greater that the largest value in the data array. | CEILING(C/O*1000) |
| INTPART(DataArray) | This will return only the non-fractional portion of Data Array. In other words,anything to the right of the decmal point is dropped. | INTPART(C) |
| MOD(DataArray1,DataArray2) | Calculates the remainder after the Data Array1 is divided by the Data Array2. | MOD(DAY,5) |
| SGN(DataArray) | This function return the sign of Data Array. | SGN(C-O) |
| REVERSE(DataArray) | This function multiplies the value of Data Array by negative one. | REVERSE(C-O) |
| Math functions 2 | ||
| SIN(DataArray) | Calculates the geometric function Sine | SIN(C) |
| COS(DataArray) | Calculates the geometric function Cosine. | COS(BARSSINCE(C)) |
| TAN(DataArray) | Calculates TAN of the Data Array. | TAN(C) |
| ASIN(DataArray) | Calculates Arc sine of the Data Array. | ASIN(C) |
| ACOS(DataArray) | Calculates Arc Cosine of the Data Array | ACOS(C) |
| ATAN(DataArray) | This is trigonometric function dealing with the ratio between angles and the legs of a right triangle. | ATAN(C) |
| LOG10(DataArray) | This function calculated 10 based logarithm of Data Array. | LOG10(C) |
| LN(Data Array) | This function calculated the natural logarithm of Data Array. | LN(C) |
| EXP(DataArray) | Calculates the mathematical constant e raised to the Data Array power. | EXP(C) |
| SQRT(DataArray) | This calculates the square root of Data Array. | SQRT(C) |
| SQR(DataArray) | Calculates the square of Data Array | SQR(C) |
| POWER(DataArray,N) | This calculates the value of Data Array raise to a specified N. | POWER(C,3) |
| POW(DataArray) | Shortcut of POWER | POW(C,3) |
| Statistics functions | ||
| STD(DataArray,N) | This calculates the value of the Standard Deviation indicator. | STD(C,10) |
| STDP(DataArray,N) | STDP(C,10) | |
| VAR(DataArray,N) | This function examines the Data Array and calculates the statistical variance over N number of records. | VAR(C,10) |
| VARP(DataArray,N) | VARP(C,10) | |
| AVEDEV(DataArray,N) | AVEDEV(C,10) | |
| DEVSQ(DataArray,N) | DEVSQ(C,10) | |
| FORCAST(DataArray,N) | FORCAST(C,10) | |
| SLOPE(DataArray,N) | SLOPE(C,10) | |
| CORR(DataArray1,DataArray2,N) | CORR(C,H,10) | |
| Index function | ||
| ZIG(DataArray,N) | This calculates the value of the Zig Zag indicator on the Data Array specified. | ZIG(C,10) |
| PEAK(DataArray,N,M) | PEAK(C,20,10) | |
| PEAKBARS(DataArray,N,M) | PEAKBARS(C,20,10) | |
| TROUGH(DataArray,N,M) | PEAKBARS(C,20,10) | |
| TROUGHBARS(DataArray,N,M) | TROUGHBARS(C,20,10) | |
| SAR(N,STEP,MAXP) | SAR(10,1,2) | |
| SARTURN(N,STEP,MAXP) | SARTURN(10,1,2) | |
| String functions | ||
| EXCHANGE | Return current market name | STKMARKET |
| CODE | Return current stock label | STKLABEL |
| NAME | Return current stock name | STKNAME |
| STKINBLOCK(string) | Return if the stock is belong to the block | STKINBLOCK("COMPUTER") |
| STRCMP(string1,string2) | Compare two string string1 and string2 | STRCMP(CODE,"MSFT") |
| STRNCMP(string1,string2,N) | Compare first N chars of string1 and string2 | STRNCMP(CODE,"MS",2) |
| Draw functions | ||
| DRAWTEXT(Condition,DataArray,s) | Draw text at DataArray when Condition is true. | DRAWTEXT(ISUP,C-1,"ISUP") |
| DRAWNUMBER(Condition,DataArray1, DataArray2,Precision) |
Draw DataArray1 at DataArray2 when Condition is true | DRAWNUMBER(ISDOWN,C+1,L,5) |
| DRAWICON(Condition,DataArray,IconIndex) | Draw Icon at DataArray when Condition is true | DRAWICON(ISUP,C-1,2) |
| POLYLINE(Condition,DataArray) | Draw Poly line at DataArray when Condition is true | POLYLINE(ISUP,C) |
| DRAWLINE(Condition1,DataArray1, Condition2,DataArray2,Expand) |
Draw Line start at Condition1,DataArray1, end with Condition2,DataArray2 | DRAWLINE(ISUP,C,ISDOWN,O,0) |
| STICKLINE(Condition,DataArray1,DataArray2, Width,Empty) |
Draw Stick line at DataArray1 and DataArray2 when Condition is true. | STICKLINE(ISUP,C,O,2,0) |
| FILLRGN(Condition,DataArray1,DataArray2) | Fill region at DataArray1 and DataArray2 when Condition is true. | FILLRGN(ISUP,C,O) |
| PARTLINE(Condition,DataArray1) | Draw partial line at DataArray1 when Condition is true. | PARTLINE(ISUP,C) |
| VERTLINE(DataArray1) | Draw vertical line at DataArray1 | VERTLINE(DAY==1) |
| GETSTOCK(O,C,H,L) | Draw candle with O,C,H,L | GETSTOCK(O,C,H+1,L-1) |
| STOCK | Draw candle of current stock | STOCK |
| Advanced functions | ||
| STKINDI(StkLabel,IndexName), FML(StkLabel,IndexName) |
Get another stock's indicator of current market. | FML("NTES","C") |
| Operators | ||
| + - * / | C+O-H*L/V | |
| > < >= <= == != | (C>O)+(H-O)>=(O-C) | |
| & | ^ % ! ~ ++ -- | C>10 & C<11 | |