ns pour l'ouverture de positions courtes Je ne sais pas.
Si c'est actuellement le contrat spécifié.
Whether ISCONTRACT(CODE) is currently the specified contract.
Usage: ISCONTRACT(CODE); It is the current contract that returns 1, not the current contract that returns 0.
Remark:
1.When judging whether it is a specified contract, CODE can be the trading code of the contract.
Example:
ISCONTRACT('this_week'); // Cryptocurrency OKEX futures contract
ISCONTRACT('XBTUSD'); // Cryptocurrency BITMEX futures contract
Les expressions régulières sont prises en charge.
Contrat de décision
ISCONTRACT('this_week'); // Determine whether the current contract is OKEX futures this_week contract
Détermination du nom de la bourse
ISCONTRACT('@Futures_(Binance|FTX)'); // Determine whether the current exchange object is Binance futures or FTX futures
ISCONTRACT('@(OKEX|Bitfinex)'); // To judge the exchange, you need to add the @ character at the beginning
Une ligne négative.
ISDOWN Determine whether the period closed negative.
Remark:
1.ISDOWN is equivalent to C<O
Examples:
ISDOWN=1&&C<REF(C,1),SK; // When the K-line closes negative and the closing price is less than the closing price of the previous period, then open short position
// ISDOWN=1&&C<REF(C,1),SK; has the same meaning as ISDOWN&&C<REF(C,1),SK;
Une plaque plate.
ISEQUAL determines whether the period is flat or not.
Remark:
1.ISEQUAL is equal to C=O
Example 1:
EVERY(ISEQUAL=1,2),CLOSEOUT; // If 2 K-lines are flat for a sustained period, then all flat
Déterminez si le point est la dernière ligne K.
ISLASTBAR judges whether the period is the last K-line.
Example 1:
VALUEWHEN(ISLASTBAR=1,REF(H,1)); // The current K-line is the last K-line, then take the highest price of the previous period
Déterminez la valeur nulle.
ISNULL Determine the null value.
Usage: ISNULL(N); If N is null, the function returns 1; if N is non-null, the function returns 0.
Example :MA5:=IFELSE(ISNULL(MA(C,5))=1,C,MA(C,5)); // Define a five-period moving average. When the number of K-lines is less than five, return the closing price of the current K-line
Une ligne positive.
ISUP determines whether the period closes positive or not.
Remark:
1.ISUP is equivalent to C>O.
Example :
ISUP=1&&C>REF(C,1),BK; // If the current K-line closes positive and the closing price is greater than the closing price of the previous period, then open a long position
// ISUP=1&&C>REF(C,1),BK; together with ISUP&&C>REF(C,1),BK
// Express the same meaning
Fonction de jugement.
LAST(COND,N1,N2) determine whether the COND condition has been satisfied in the past N1 to N2 periods.
Remarks:
1.If the difference between N1 and N2 is only one period (such as N1=3, N2=2), the function determines whether the condition is satisfied on the period closest to the current K-line (that is, to determine whether the K-line in the past N2 periods satisfies the condition or not) ).
2.When N1/N2 is a valid value, but the current number of K-lines is less than N1/N2, or the case of N1/N2 null, the representative is not valid and the function returns 0.
3.N1 and N2 cannot be variables.
Example 1:
LAST(CLOSE>OPEN,10,5); // Indicates a positive line from the 10th period to the 5th period in the past
Example 2:
MA5:=MA(C,5);
LAST(C>MA5,4,3); // Determine if the K-line that is 3 periods away from the current K-line meets C is greater than MA5
Maintenez la fonction croisée.
LONGCROSS(A,B,N)Indicates that A is less than B in N periods, and A crosses B from bottom to top in this period.
Remarks:
1.When N is a valid value, but the current number of K-lines is less than N, the LONGCROSS function returns null.
2.N does not support variables.
Example 1:
LONGCROSS(CLOSE,MA(CLOSE,10),20); // Indicates that the closing line is below the 10-day SMA for 20 periods and then crosses the 10-day SMA from bottom to top
Not.
NOT(X): Takes not. Returns 1 when X = 0, otherwise returns 0.
Example 1:
NOT(ISLASTBK); If the last signal is not a BK signal, NOT(ISLASTBK) returns a value of 1; if the last signal is a BK signal, NOT(ISLASTBK) returns a value of 0.
Example 2:
NOT(BARSBK>=1)=1; // BK signal is issued when the current K-line meets the conditions
// NOT(BARSBK>=1)=1 has the same meaning as NOT(BARSBK>=1)
Retour nul.
Return null
Usage:
MA5:=MA(C,5);
MA10:=MA(C,10);
A:=IFELSE(MA5>MA10,MA5,NULL),COLORRED; // When MA5>MA10, draw the five-day moving average MA5, when MA5>MA10 is not satisfied, return null and no line is drawn
Prenez des valeurs.
VALUEWHEN(COND,X)When the COND condition is true, the current value of X is taken. If the COND condition is not established, the value of X when the last COND condition is established is taken.
Remark:
X can be a numerical value or a condition.
Example 1:
VALUEWHEN(HIGH>REF(HHV(HIGH,5),1),HIGH); // Indicates that the current highest price is returned when the current highest price is greater than the maximum value of the highest prices in the previous five periods
Example 2:
VALUEWHEN(DATE<>REF(DATE,1),O); // Indicates to take the opening price of the first K-line of the day (that is, the opening price of the day)
Example 3:
VALUEWHEN(DATE<>REF(DATE,1),L>REF(H,1)); // Indicates whether the current low price is greater than the high price of yesterday's last K-line on the first K-line of the day. Returns 1, indicating that the day jumped higher. If returns 0, it means the day does not meet the condition of jumping high.
Fonction de condition de boucle.
LOOP2(COND,A,B); The loop condition function returns A if the COND condition is true, otherwise returns B.
Remarks:
1.COND is a judgment condition; A and B can be conditions or values.
2.This function supports variable circular reference to the previous period's own variable, that is, supports the following writing method Y:=LOOP2(CON,X,REF(Y,1));
Example 1:
X:=LOOP2(ISUP,H,REF(X,1)); // If the K-line is a positive line, take the highest price of the current K-line, otherwise, take the highest price of the K-line that was a positive line last time; if there has been no positive line before, X returns null
Example 2:
BB:=LOOP2(BARSBK=1,LOOP2(L>LV(L,4),L,LV(L,4)),LOOP2(L>REF(BB,1),L,REF(BB,1))); // When holding a long order, the lowest price in the previous 4 periods of the long order is the starting stop loss point BB, the lowest price of the subsequent K-line is higher than the previous lowest price, and the current lowest price stop loss point is taken, otherwise take the previous low and stop loss
SS:=LOOP2(BARSSK=1,LOOP2(H<HV(H,4),H,HV(H,4)),LOOP2(H<REF(SS,1),H,REF(SS,1))); // When holding a short order, the highest price in the previous 4 periods of the short order is the starting stop loss point SS, the highest price is lower than the previous highest price, and the current highest price stop loss point is taken, otherwise take the stop loss point of the previous high point
H>HV(H,20),BK;
L<LV(L,20),SK;
C<BB,SP;
C>SS,BP;
AUTOFILTER;
Le nombre de périodes entre la première période de validité et la période en cours.
BARSCOUNT(COND)The number of periods from the first valid period to the current one.
Remarks:
1.The return value is the number of periods counted by COND from the first valid period until now.
2.When the condition is satisfied for the first time, the return value of BARSCOUNT(COND) on the K-line is 0.
Example:
BARSCOUNT(MA(C,4)); // Calculate the number of periods from the first time MA(C,4) has a return value to the current one
La position où la dernière condition a été remplie.
BARSLAST(COND), the number of periods since the last time the condition COND was established.
Remark:
1.When the condition is satisfied, the return value of BARSLAST(COND) on the current K-line is 0.
Example 1:
BARSLAST(OPEN>CLOSE); // Number of periods from the last negative line to the present
Example 2:
N:=BARSLAST(DATE<>REF(DATE,1))+1; // Minute period, number of K-lines for the day
// Since the return value of BARSLAST(COND) is 0 for the current K-line when the condition is established, "+1" is the number of k-lines for that day
Description de l'appareilBARSLAST
fonction:
Le nombre de périodes allant du moment où la première condition a été établie à celle actuelle.
BARSSINCE(COND)the number of periods from when the first condition was established to the current one.
Remarks:
1.The return value is the number of periods from the first time COND was established to the current.
2.When the condition is satisfied for the first time, the return value of BARSSINCE(COND) on the K-line is 0.
Example:
BARSSINCE(CLOSE>OPEN); // Count the number of periods from the first positive K-line to the present
Comptez le nombre de périodes allant de la première condition détenue en N périodes à celle en cours.
BARSSINCEN(COND,N) counts the number of periods between the first condition held in N periods and the current one.
Remarks:
1.N contains the current K-line.
2.When N is valid, but the current number of K-lines is less than N, it is calculated according to the actual number of lines.
3.Returns null if N is 0.
4.N can be a variable.
Examples:
N:=BARSLAST(DATE<>REF(DATE,1))+1; // Minute period, the number of K-lines on the day
BARSSINCEN(ISUP,N); // Count the number of periods from the first positive line met in N periods to the current period
Obtenez le nombre de périodes entre les lignes K les plus récentes qui satisfont à la condition A,B.
CONDBARS(A,B); obtain the number of periods between the most recent K-lines that satisfy the A,B condition.
Attention:
1.This function returns the number of periods without the last K-line that meets the condition.
2.The closest satisfied condition to the current K-line is the B condition, then the function returns the number of periods from the last K-line that satisfied the A condition to the K-line that satisfied the B condition (the first K-line that satisfied the B condition after the A condition was satisfied).
The closest satisfied condition to the current K-line is the A condition, then the function returns the number of periods from the last K-line that satisfied the B condition to the K-line that satisfied the A condition (the first K-line that satisfied the A condition after the B condition was satisfied).
Example 1:
MA5:=MA(C,5); // 5-period moving average
MA10:=MA(C,10); // 10-period moving average
CONDBARS(CROSSUP(MA5,MA10),CROSSDOWN(MA5,MA10)); // The number of periods between the last time the 5-period moving average crosses the 10-period moving average and the 5-period moving average crosses the 10-period moving average
Les statistiques totales.
COUNT(COND,N), counts the number of periods in N periods that satisfy the COND condition.
Remarks:
1.N contains the current K-line.
2.If N is 0, count from the first valid value.
3.If N is valid, but the current number of K-lines is less than N, count from the first one to the current period.
4.If N is null, the return value is null.
5.N can be a variable.
Example 1:
N:=BARSLAST(DATE<>REF(DATE,1))+1; // Minute period, the number of K-lines on the day
M:=COUNT(ISUP,N); // Count the number of positive lines since the market opened in the minute period
Example 2:
MA5:=MA(C,5); // Define the 5-period moving average
MA10:=MA(C,10); // Define the 10-period moving average
M:=COUNT(CROSSUP(MA5,MA10),0); // Count the number of times that the 5-period moving average crossed the 10-period moving average during the period from the applied market data to the current period.
Moyenne mobile dynamique.
DMA(X,A): Find the dynamic moving average of X, where A must be less than 1 and greater than 0.
Remarks:
1.A can be a variable.
2.If A<=0 or A>=1, return null.
Calculation formula: DMA(X,A)=REF(DMA(X,A),1)*(1-A)+X*A
Example 1:
DMA3:=DMA(C,0.3); // The calculation result is REF(DMA3,1)*(1-0.3)+C*0.3
Moyenne mobile pondérée par indice.
EMA(X,N): finds the index-weighted moving average (smoothed moving average) of the N-period X values.
Remarks:
1.N contains the current K-line.
2.A larger weight is given to the K-line that is closer to the current one.
3.When N is valid, but the current number of K-lines is less than N, the actual number of lines will be counted.
4.When N is 0 or null, the return value is null.
5.N can be a variable.
EMA(X,N)=2*X/(N+1)+(N-1)*REF(EMA(X,N),1)/(N+1)
Example 1:
EMA10:=EMA(C,10); // Find the 10-period index-weighted moving average of closing prices
moyenne mobile pondérée linéaire.
EMA2(X,N); // Find the linear weighted moving average (also known as WMA) of the N period X values
EMA2(X,N)=[N*X0+(N-1)*X1+(N-2)*X2+...+1*X(N-1)]/[N+(N-1)+(N-2)+...+1], X0 represents the current period value, X1 represents the previous period value
Remarks:
1.N contains the current K-line.
2.When N is valid, but the current number of K-lines is less than N, the return value is null.
3.When N is 0 or null, the return value is null.
4.N can be a variable.
Example 1:
EMA2(H,5); // Find the linearly weighted moving average of the highest price over 5 periods
Moyenne mobile pondérée par indice.
EMAWH(C,N), index-weighted moving average, also known as smoothed moving average, it uses index-weighted method to give greater weight to the K-line that is closer to the current one.
Remark:
1.When N is valid and the current number of K-lines is less than N, or when the value of the previous period is still applied to the current period, EMAWH returns null.
Because the weight of the current period is mainly considered in the EMAWH calculation formula, when the period is longer, the previous period value has less influence on the current period. EMAWH starts showing the values taken when the previous data no longer affects the current period, so even if the selected data starts at a different time, the EMAWH value of the currently displayed K-line will not change.
2.When N is 0 or null, the return value is null.
3.N cannot be a variable.
EMAWH(C,N)=2*C/(N+1)+(N-1)*REF(EMAWH(C,N),1)/(N+1)
Remark:
EMAWH is used in the same way as EMA(C,N)
Moyenne de réconciliation.
HARMEAN(X,N), Find the reconciliation average of X over N periods.
Example of algorithm: HARMEAN(X,5)=1/[(1/X1+1/X2+1/X3+1/X4+1/X5)/5]
Remarks:
1.N contains the current K-line.
2.The reconciliation average and the reciprocal simple average are the reciprocals of each other.
3.When N is valid, but the current number of K-lines is less than N, the function returns null.
4.When N is 0 or null, the function returns null.
5.When X is 0 or null, the function returns null.
6.N can be a variable.
Example:
HM5:=HARMEAN(C,5); // Find the reconciliation average of the 5-period closing prices
La plus haute valeur.
HHV(X,N): Find the highest value of X over N periods.
Remark:
1.N contains the current K-line.
2.If N is 0, start counting from the first valid value.
3.When N is valid, but the current number of K-lines is less than N, calculate according to the actual number of lines.
4.When N is null, the return value is null.
5.N can be a variable.
Example 1:
HH:=HHV(H,4); // Find the maximum value of the highest price in 4 periods, that is, the 4-period high point (including the current K-line)
Example 2:
N:=BARSLAST(DATE<>REF(DATE,1))+1; // Minute period, the number of K-lines in the day
HH1:=HHV(H,N); // In the minute period, the high point in the day
La valeur la plus élevée à l'exception de la ligne K actuelle.
HV(X,N), Find the highest value of X in N periods (excluding the current K-line).
Remarks:
1.If N is 0, it starts from the first valid value (excluding the current K-line).
2.When N is valid, but the current number of K-lines is less than N, the first K-line returns null according to the actual number of K-lines.
3.When N is null, the return value is null.
4.N can be a variable.
Example 1:
HH:=HV(H,10); // Find the highest point of the first 10 K-lines
Example 2:
N:=BARSLAST(DATE<>REF(DATE,1))+1;
NN:=REF(N,N);
ZH:=VALUEWHEN(DATE<>REF(DATE,1),HV(H,NN)); // In the minute period, find the highest price yesterday
Example 3:
The results of HV(H,5) and REF(HHV(H,5),1) are the same, and it is more convenient to write in HV.
La position la plus élevée précédente.
HHVBARS(X,N), find the highest value of X in N periods to the current number of periods.
Remarks:
1.If N is 0, it starts from the first valid value (excluding the current K-line).
2.When N is valid, but the current number of K-lines is less than N, the first K-line returns null according to the actual number of K-lines.
3.When N is null, the return value is null.
4.N can be a variable.
Example 1:
HHVBARS(VOL,0); // Find the period with the largest historical volume to the current number of periods (the return value of HHVBARS(VOL,0); on the K-line with the maximum value is 0, and the return value of the first K-line after the maximum value is 1, and so on)
Example 2:
N:=BARSLAST(DATE<>REF(DATE,1))+1; // Minute period, the number of K-lines in the day
ZHBARS:=REF(HHVBARS(H,N),N)+N; // In the minute period, find the number of periods between the K-line where the highest price was yesterday and the current K-line
La valeur minimale.
LLV(X,N), find the minimum value of X over N periods.
Remarks:
1.N contains the current K-line.
2.If N is 0 then the count starts from the first valid value.
3.When N is valid, but the current number of K-lines is less than N, it is calculated according to the actual number of lines.
4.When N is null, the return value is null.
5.N can be a variable.
Example 1:
LL:=LLV(L,5); // Find the lowest point of 5 K-lines (including the current K-line)
Example 2:
N:=BARSLAST(DATE<>REF(DATE,1))+1; // Minute period, the number of K-lines in the day
LL1:=LLV(L,N); // In the minute period, find the minimum value from the first K-line of the day to the lowest price of all K-lines in the current period
La valeur la plus basse à l'exception de la ligne K actuelle.
LV(X,N), find the minimum value of X in N periods (excluding the current K-line).
Remarks:
1.If N is 0 then the count starts from the first valid value.
2.When N is valid, but the current number of K-lines is less than N, it is calculated according to the actual number of lines.
3.When N is null, the return value is null.
4.N can be a variable.
Example 1:
LL:=LV(L,10); // Find the lowest point of the previous 10 K-lines (excluding the current K-line)
Example 2:
N:=BARSLAST(DATE<>REF(DATE,1))+1; // Minute period, the number of K-lines in the day
NN:=REF(N,N);
ZL:=VALUEWHEN(DATE<>REF(DATE,1),LV(L,NN)); // Find the lowest price yesterday in the minute period.
Example 3:
The results of LV(L,5) and REF(LLV(L,5),1) are the same, and it is more convenient to write with LV.
Le point le plus bas précédent.
LLVBARS(X,N), find the lowest value of X in N periods to the current number of periods.
Remarks:
1.If N is 0, it starts from the first valid value (excluding the current K-line).
2.When N is valid, but the current number of K-lines is less than N, it is calculated according to the actual number of lines, the first K-line returns null.
3.When N is null, the return value is null.
4.N can be a variable.
Example 1:
LLVBARS(VOL,0); // Find the period with the smallest historical volume to the current number of periods (the return value of HHVBARS(VOL,0); on the K-line with the minimum value is 0, and the return value of the first K-line after the minimum value is 1, and so on)
Example 2:
N:=BARSLAST(DATE<>REF(DATE,1))+1; // Minute period, the number of K-lines in the day
ZLBARS:=REF(LLVBARS(L,N),N)+N; // In the minute period, find the number of periods between the K-line where yesterday's lowest price is located to the current K-line.
Moyenne mobile arithmétique.
MA(X,N), find the simple moving average of X over N periods.
Algorithm: MA(X,5)=(X1+X2+X3+X4+X5)/5
Remarks:
1.N contains the current K-line.
2.Simple moving averages follow the simplest statistical approach, taking the average of prices over a specific period of time in the past.
3.When N is valid, but the current number of K-lines is less than N, the function returns null.
4.When N is 0 or null, the function returns null.
5.N can be a variable.
Example 1:
MA5:=MA(C,5); // Find the simple moving average of the 5-period closing price
Example 2:
N:=BARSLAST(DATE<>REF(DATE,1))+1; // Minute period, the number of K-lines in the day
M:=IFELSE(N>10,10,N); // If there are more than 10 K-lines, M takes 10, otherwise M takes the actual number
MA10:=MA(C,M); // In the minute period, if the number of K-lines on the day is less than 10, the MA10 is calculated according to the actual number of K-lines, and the MA10 is calculated according to the 10-period if it is more than 10 K-lines.
Prenez la moyenne.
MV(A,...P), take the average of A to P.
Remarks:
1.It supports to take the average of 2-16 values.
2.A...P can be numbers or variables.
Example 1:
MV(CLOSE,OPEN); // Take the average of the closing and opening prices
La somme des puissances des nombres naturels.
NUMPOW(X,N,M), sum of powers of natural numbers.
Algorithm:
NUMPOW(x,n,m)=n^m*x+(n-1)^m*ref(x,1)+(n-2)^m*ref(x,2)+...+2^m*ref(x,n-2)+1^m*ref(x,n-1)
Attention:
1.N is a natural number, M is a real number; and N and M cannot be variables.
2.X is the basic variable.
Example:
JZ:=NUMPOW(C,5,2);
Direction parabolique.
SAR(N,STEP,MAX), returns the parabolic steering value.
Calculated according to the formula SAR(n)=SAR(n-1)+AF*(EP(n-1)-SAR(n-1)).
Among which:
SAR(n-1): The absolute value of the last K-line SAR.
AF: acceleration factor, when AF is less than MAX, it is accumulated by AF+STEP one by one, and AF is recalculated when the ups and downs are converted.
EP: An extreme value within an up or down market is the highest price of the previous K-line in an up market; the lowest price of the previous K-line in a down market.
Remark:
1.parameter N, Step, Max do not support variables.
Example 1:
SAR(17,0.03,0.3); // Indicates that 17 periods of parabolic steering are calculated, the step size is 3%, and the limit value is 30%
Moyenne mobile pondérée par indice étendue.
SMA(X,N,M) find the extended index-weighted moving average over N periods of X, where M is the weight.
Calculation formula: SMA(X,N,M)=REF(SMA(X,N,M),1)*(N-M)/N+X(N)*M/N
Remarks:
1.When N is valid, but the current number of K-lines is less than N, it is calculated according to the actual number of lines.
2.When N is 0 or null, the function returns null.
Example 1:
SMA10:=SMA(C,10,3); // Extended index-weighted moving average of the 10-period closing price found, with a weight of 3
Une moyenne mobile fluide.
SMMA(X,N), X is a variable, N is a period, SMMA(X, N) represents the fluent moving average of X in N periods on the current K-line
Algorithm: SMMA(X,N)=(SUM1-MMA+X)/N
Among which SUM1=X1+X2+.....+XN
MMA=SUM1/N
Example 1:
SMMA(C,5); // The 5-period fluent moving average of the closing price
Prenez la valeur triée à la position correspondante.
SORT(Type,POS,N1,N2,...,N16); Arrange in ascending (descending) order, and take the value corresponding to the POSth parameter.
Remarks:
1.When Type is 0, it is sorted in ascending order, and when Type is 1, it is sorted in descending order.
2.TYPE, POS, variables are not supported.
3.N1,...,N16 are parameters, support constants, variables, up to 16 parameters.
Example:
SORT(0,3,2,1,5,3); // 2, 1, 5, 3 are arranged in ascending order, take the third number 3
SUM.
SUM(X,N), find the sum of X over N periods.
Remarks:
1.N contains the current K-line.
2.If N is 0, start counting from the first valid value.
3.When N is valid, but the current number of K-lines is less than N, it is calculated according to the actual number of lines.
4.When N is null, the return value is null.
5.N can be a variable.
Example 1:
SUM(VOL,25); Indicates the total trading volume within 25 periods of statistics.
Example 2:
N:=BARSLAST(DATE<>REF(DATE,1))+1; // Minute period, the number of K-line in the day
SUM(VOL,N); // In the minute period, take the sum of the day's trading volume
Le nombre de périodes à accumuler à la valeur spécifiée.
SUMBARS(X,A), fine the number of periods to accumulate to the specified value.
Remark:
parameter A supports variables.
Example 1:
SUMBARS(VOL,20000); Accumulate the volume forward until it is greater than or equal to 20000, and return the period number of this range.
Moyenne mobile triangulaire.
TRMA(X,N), find the triangular moving average of X over N periods.
Algorithm: The triangular moving average formula is to take an arithmetic moving average and apply the arithmetic moving average again to the first moving average.
The TRMA(X,N) algorithm is as follows:
ma_half= MA(X,N/2)
trma=MA(ma_half,N/2)
Remarks:
1.N contains the current K-line.
2.When N is valid, but the current number of K-lines is less than N, the function returns null.
3.When N is 0 or null, the function returns null.
4.N supports the use of variables.
Example 1:
TRMA5:=TRMA(CLOSE,5); // Calculates the triangular moving average of closing prices over 5-period. (N is not divisible by 2)
// TRMA(CLOSE,5)=MA(MA(CLOSE,(5+1)/2)),(5+1)/2);
Example 2:
TRMA10:=TRMA(CLOSE,10); // Calculates a triangular moving average of closing prices over 10-period. (N is divisible by 2)
// TRMA(CLOSE,10)=MA(MA(CLOSE,10/2),(10/2)+1));
Moyenne mobile des séries chronologiques.
TSMA(X,N), find the time series triangular moving average of X over N periods.
TSMA(a,n) the algorithm is as follows:
ysum=a[i]+a[i-1]+...+a[i-n+1]
xsum=i+i-1+..+i-n+1
xxsum=i*i+(i-1)*(i-1)+...+(i-n+1)*(i-n+1)
xysum=i*a[i]+(i-1)*a[i-1]+...+(i-n+1)*a[i-n+1]
k=(xysum -(ysum/n)*xsum)/(xxsum- xsum/n * xsum) // slope
b= ysum/n - k*xsum/n
forcast[i]=k*i+b // Linear regression
tsma[i] = forcast[i]+k // Linear regression + slope
Remarks:
1.When N is valid, but the current number of K-lines is less than N, the function returns null.
2.When N is 0 or null, the function returns null.
3.N supports the use of variables.
Example 1:
TSMA5:=TSMA(CLOSE,5); // Calculate the serial triangular moving average of closing prices over 5 periods
Déviation absolue moyenne.
AVEDEV(X,N), returns the average absolute deviation of X over N periods.
Remarks:
1.N contains the current K-line.
2.N is valid, but the current number of K-lines is less than N, the function returns null.
3.When N is 0, the function returns null.
4.N is null, the function returns null.
5.N cannot be a variable.
Example of algorithm: Calculate the value of AVEDEV(C,3); on the latest K-line.
It can be expressed by MyLanguage functions as follows:
(ABS(C-(C+REF(C,1)+REF(C,2))/3)+ABS(REF(C,1)-(C+REF(C,1)+REF(C,2))/3)+ABS(REF(C,2)-(C+REF(C,1)+REF(C,2))/3))/3;
Example:
AVEDEV(C,5); // Returns the average absolute deviation of the closing price over 5 periods
// Indicates the average value of the absolute value of the difference between the closing price of each period and the average value of the closing prices in 5 periods, and judges the degree of deviation between the closing price and its average value
Coefficient de corrélation de Pearson.
COEFFICIENTR(X,Y,N), find the Pearson correlation coefficient of X and Y over N periods.
Remarks:
1.N contains the current K-line.
2.N is valid, but the current number of K-lines is less than N, the function returns null.
3.When N is 0, the function returns null.
4.N is null, the function returns null.
5.N can be a variable.
Example of algorithm: Calculate COEFFICIENTR(O, C, 3); the value on the nearest K-line.
It can be expressed by MyLanguage functions as follows:
(((O-MA(O,3))*(C-MA(C,3))+(REF(O,1)-MA(O,3))*(REF(C,1)-MA(C,3))+(REF(O,2)-MA(O,3))*(REF(C,2)-MA(C,3))) /(STD(O,3)*STD(C,3)))/(3-1);
Example:
COEFFICIENTR(C,O,10); //Find the Pearson correlation coefficient over 10 periods
//The Pearson correlation coefficient is a measure of the degree of correlation between two random variables
Coefficient de corrélation.
CORRELATION(X,Y,N), find the correlation coefficient of X and Y in N periods.
Remarks:
1.N contains the current K-line.
2.N is valid, but the current number of K-lines is less than N, the function returns null.
3.When N is 0, the function returns null.
4.N is null, the function returns null.
5.N can be a variable.
Example of algorithm: Calculate CORRELATION(O,C,3); the value on the latest K-line.
In terms of a MyLanguage function, it can be expressed as follows:
(((O-MA(O,3))*(C-MA(C,3))+(REF(O,1)-MA(O,3))*(REF(C,1)-MA(C,3))+(REF(O,2)-MA(O,3))*(REF(C,2)-MA(C,3))))/SQRT((SQUARE(O-MA(O,3))+SQUARE(REF(O,1)-MA(O,3))+SQUARE(REF(O,2)-MA(O,3)))*(SQUARE(C-MA(C,3))+SQUARE(REF(C,1)-MA(C,3))+SQUARE(REF(C,2)-MA(C,3))));
Example:
CORRELATION(C,O,10); // Find the correlation coefficient over 10 periods
// The correlation coefficient is a measure of the degree of correlation between two random variables
Covariance.
COVAR(X,Y,N) Find the covariance of X and Y over N periods.
Remarks:
1.N contains the current K-line.
2.N is valid, but the current number of K-lines is less than N, the function returns null.
3.When N is 0, the function returns null.
4.N is null, the function returns null.
5.N can be a variable.
Example of algorithm: Calculate COVAR(O,C,3); the value on the nearest K-line.
In terms of a MyLanguage function, it can be expressed as follows:
(((O-MA(O,3))*(C-MA(C,3))+(REF(O,1)-MA(O,3))*(REF(C,1)-MA(C,3))+(REF(O,2)-MA(O,3))*(REF(C,2)-MA(C,3))) )/3;
Example:
COVAR(C,O,10); // Find the covariance over 10 periods
// The variance between two different variables is the covariance. If the trend of the two variables is the same, then the covariance between the two variables is positive; if the trend of the two variables is opposite, then the covariance between the two variables is negative
Obtenez la somme des écarts de données au carré.
DEVSQ(X,N): Calculate the sum of squares of data deviations for N periods of data X.
Remarks:
1.N contains the current K-line.
2.N is valid, but the current number of K-lines is less than N, the function returns null.
3.When N is 0, the function returns null.
4.N is null, the function returns null.
5.N is not supported as a variable.
Example of algorithm: Calculate the value of DEVSQ(C,3); on the nearest K-line.
In terms of a MyLanguage function, it can be expressed as follows:
SQUARE(C-(C+REF(C,1)+REF(C,2))/3)+SQUARE(REF(C,1)-(C+REF(C,1)+REF(C,2))/3)+SQUARE(REF(C,2)-(C+REF(C,1)+REF(C,2))/3);
Example:
DEVSQ(C,5); // Calculate the sum of squared data deviations for 5 periods of the data closing price
//Represents the sum of the square deviation between the closing price and the average closing price respectively, DEVSQ (C, 5) means the sum of the square deviations between the closing price and the average closing price of the 5 periods
Valeur de régression linéaire.
Forcast (x, n) is the predicted value of N-period linear regression of X.
Remarks:
1.N contains the current K-line.
2.N is valid, but the current number of K-lines is less than N, the function returns null.
3.When N is 0, the function returns null.
4.N is null, the function returns null.
5.N can be a variable.
Example of algorithm: Calculate the value of FORCAST(C,3) on the nearest K-line by using the least square method.
1.Establish a linear formula of one variable: y=a+b*i+m
2.Estimated value of Y: y(i)^=a+b*i
3.Find the residuals: m^=y(i)-y(i)^=y(i)-a-b*i
4.Sum of squared errors.
Q=m(1)*m(1)+...+m(3)*m(3)=[y(1)-a-b*1]*[y(1)-a-b*1]+...+[y(3)-a-b*3]*[y(3)-a-b*3]
5.Find the first-order partial derivative of parameters a and b in the linear formula:
2*{[y(1)-a-b*1]+...+[y(3)-a-b*3]}*(-1)=0
2*[y(1)-a-b*1]*(-1)+...+[y(3)-a-b*3]*(-3)=0
6.Combine the above two formulas and solve for the values of a,b:
a=(y(1)+y(2)+y(3))/3-b(i(1)+i(2)+i(3))/3
b=(y(1)*i(1)+y(2)*i(2)+y(3)*i(3)-(3*((i(1)+i(2)+i(3))/3)*((y(1)+y(2)+y(3))/3))/((i(1)^2+i(2)^2+i(3)^2)-3*((i(1)+i(2)+i(3))/3)^2)
7.Bring the values of a, b, and i to 1 to find the value of y.
The above formula can be expressed in terms of a MyLanguage function as follows:
BB:=(3*C+2*REF(C,1)+REF(C,2)-(3*((1+2+3)/3)*MA(C,3)))/((SQUARE(1)+SQUARE(2)+SQUARE(3))-3*SQUARE((1+2+3)/3));
AA:=MA(C,3)-BB*(1+2+3)/3;
YY:=AA+BB*3;
Example:
FORCAST(CLOSE,5); // Means to calculate the predicted value of 5-period linear regression
Le coefficient de Kurtose.
KURTOSIS(X,N), find the kurtosis coefficient of X over N periods.
Remarks:
1.N contains the current K-line.
2.N is valid, but the current number of K-lines is less than N, the function returns null.
3.When N is 0, the function returns null.
4.N is null, the function returns null.
5.N can be a variable.
6.N is at least 4, if less than 4, returns null.
Example of algorithm: Calculate KURTOSIS(C,4); the value on the nearest K-line.
In terms of a MyLanguage function, it can be expressed as follows:
((POW(C-MA(C,4),4)+POW(REF(C,1)-MA(C,4),4)+POW(REF(C,2)-MA(C,4),4)+POW(REF(C,3)-MA(C,4),4)) /POW(STD(C,4),4))*(4*(4+1)/((4-1)*(4-2)*(4-3)))-3*SQUARE(4-1)/((4-2)*(4-3));
Example:
KURTOSIS(C,10); // Indicates the 10-period peak of the closing price. The peak reflects the sharpness or flatness of a distribution compared to a normal distribution. Positive peaks indicate a relatively sharp distribution. Negative peaks indicate a relatively flat distribution
Densité de probabilité de distribution normale.
NORMPDF(X,MU,SIGMA), the return parameter is the value of the normal distribution density function of MU and SIGMA at X.
Remarks:
1.If MU or SIGMA is null, the function returns null.
2.MU and SIGMA support variables.
Example of algorithm: The random variable X obeys a probability distribution with location parameter MU and scale parameter SIGMA, and its probability density is NORMPDF(X,MU,SIGMA).
It can be approximately expressed as follows by using MyLanguage function:
(1/(SQRT(2*3.14)*SIGMA))*EXP((-SQUARE(X-MU))/(2*SQUARE(SIGMA)));
Example:
TR:=MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));
ATR:=MA(TR,26); // Find the simple moving average of TR over 26 periods
ZZ..NORMPDF(ATR,0,1); // Define the variable ZZ and return the probability density of ATR following the standard normal distribution
Le coefficient d'écartement.
SKEWNESS(X,N), Find the skewness coefficient of X over N periods.
Remarks:
1.N contains the current K-line.
2.N is valid, but the current number of K-lines is less than N, the function returns null.
3.When N is 0, the function returns null.
4.N is null, the function returns null.
5.N can be a variable.
6.N is at least 3, if less than 3, returns null.
Example of algorithm: Calculate SKEWNESS(C,3); the value on the nearest K-line.
In terms of a MyLanguage function, it can be expressed as follows:
((POW(C-MA(C,3),3)+POW(REF(C,1)-MA(C,3),3)+POW(REF(C,2)-MA(C,3),3)) /POW(STD(C,3),3))*3/((3-1)*(3-2));
Example:
SKEWNESS(C,10); // The 10-period skewness of the closing price reflects the asymmetry of the distribution, and the asymmetry reflects the degree of asymmetry of the distribution centered on the average value. Positive asymmetry indicates that the asymmetric part of the distribution tends to be more positive, while negative asymmetry indicates that the asymmetric part of the distribution tends to be more negative
Pente de régression linéaire.
SLOPE(X,N), the slope of the linear regression of the N periods of X is obtained.
Remarks:
1.N contains the current K-line.
2.N is valid, but the current number of K-lines is less than N, the function returns null.
3.When N is 0, the function returns null.
4.If N is null, the function returns null.
5.N can be a variable.
For example:
Calculate the value of SLOPE(CLOSE,5) on the latest K-line by using the least-square method.
1.Establish a linear formula of one variable: close=a+slope*i+m
2.The estimated value of close: close(i)^=a+slope*i
3.Find the residuals: m^=close(i)-close(i)^=close(i)-a-slope*i
4.Sum of squared errors.
Q=m(1)*m(1)+...+m(5)*m(5)=[close(1)-a-slope*1]*[close(1)-a-slope*1]+...+[close(5)-a-slope*5]*[close(5)-a-slope*5]
5.Find the first order partial derivatives for the parameters a,slope in the linear formula:
2*{[close(1)-a-slope*1]+...+[close(5)-a-slope*5]}*(-1)=0
2*{[close(1)-a-slope*1]+...+[close(5)-a-slope*5]}*(-5)=0
6.Combine the above two formulas to inverse the slope value:
slope={[5*close(1))+...+1*close(5)]-[close(1)+...+close(5)]*(1+2+3+4+5)/5}/[(1*1+...+5*5)-(1+...+5)(1+...+5)/5]
In terms of a MyLanguage function, the above formulas can be expressed as follows:
((5*C+4*REF(C,1)+3*REF(C,2)+2*REF(C,3)+1*REF(C,4))-SUM(C,5)*(1+2+3+4+5)/5)/((SQUARE(1)+SQUARE(2)+SQUARE(3)+SQUARE(4)+SQUARE(5))-SQUARE(1+2+3+4+5)/5);
Example:
SLOPE(CLOSE,5); // Indicates the slope of the 5-period linear regression line for calculating the closing price
Déviation type de l'échantillon.
STD(X,N), find the sample standard deviation of X over N periods.
Remarks:
1.N contains the current K-line.
2.N is valid, but the current number of K-lines is less than N, the function returns null.
3.When N is 0, the function returns null.
4.N is null, the function returns null.
5.N can be a variable.
Example of algorithm: Calculate the value of STD(C,3); on the nearest K-line.
In terms of a MyLanguage function, it can be expressed as follows:
SQRT((SQUARE(C-MA(C,3))+SQUARE(REF(C,1)-MA(C,3))+SQUARE(REF(C,2)-MA(C,3)))/2);
Examples:
STD(C,10); // Calculate the sample standard deviation of closing price within 10 periods
// The standard deviation represents the square root of the arithmetic average of the squared deviation of the standard value of each unit of the overall population from its average, which reflects the degree of dispersion of a data set. STD(C,10) represents the arithmetic square root of the mean of the sum of the squares of the differences between the closing price and the 10-period mean of the closing price. The sample standard deviation is the square root of the sample variance
Déviation type globale.
STDP(X,N), is the overall standard deviation of N periods of X.
Remarks:
1.N contains the current K-line.
2.N is valid, but the current number of K-lines is less than N, the function returns null.
3.When N is 0, the function returns null.
4.N is null, the function returns null.
5.N can be a variable.
Example of algorithm: Calculate the value of STDP(C,3); on the nearest K-line.
In terms of a MyLanguage function, it can be expressed as follows:
SQRT((SQUARE(C-MA(C,3))+SQUARE(REF(C,1)-MA(C,3))+SQUARE(REF(C,2)-MA(C,3)))/3);
Examples:
STDP(C,10); //It is the overall 10-period standard deviation of the closing price
// The overall standard deviation is a statistical indicator that reflects the degree of variation between individuals within the research population. The overall variance is the average of the sum of the squared deviations of each value from its arithmetic average, and the overall standard deviation is the square root of the overall variance.
Variance de l'échantillon.
VAR(X,N), find the sample variance of X over N periods.
Remarks:
1.N contains the current K-line.
2.N is valid, but the current number of K-lines is less than N, the function returns null.
3.When N is 0, the function returns null.
4.N is null, the function returns null.
5.N supports the use of variables.
Example of algorithm: Calculate the value of VAR(C,3);on the nearest K-line.
In terms of a MyLanguage function, it can be expressed as follows:
(SQUARE(C-MA(C,3))+SQUARE(REF(C,1)-MA(C,3))+SQUARE(REF(C,2)-MA(C,3)))/(3-1);
Examples:
VAR(C,5); // Find the sample variance of the closing price within 5 periods
// indicates N/(N-1) times the overall variance and VAR(C,5) indicates 5/4 times the overall sample variance of the 5 period of the closing price
Variance globale
VARP(X,N), is the N-period overall variance of X.
Remarks:
1.N contains the current K-line.
2.N is valid, but the current number of K-lines is less than N, the function returns null.
3.When N is 0, the function returns null.
4.N is null, the function returns null.
5.N supports the use of variables.
Example of algorithm: Calculate VARP(C,3); the value on the nearest K-line.
In terms of a MyLanguage function, it can be expressed as follows:
(SQUARE(C-MA(C,3))+SQUARE(REF(C,1)-MA(C,3))+SQUARE(REF(C,2)-MA(C,3)))/3;
Examples:
VARP(C,5); // It is the 5-period overall variance of the closing price
// Indicates the sum of squared data deviations divided by the total number of periods N. VARP(C,5) indicates the sum of squared data deviations for 5 periods of the closing price divided by 5
Des valeurs absolues.
ABS(X), the absolute value of X taken.
Remarks:
1.The absolute value of a positive number is itself.
2.The absolute value of a negative number is its opposite.
3.The absolute value of 0 is still 0.
Example 1:
ABS(-10); // Return 10
Example 2:
ABS(CLOSE-10); // Return the absolute value of the closing price and the 10 spread
Example 3:
ABS(C-O); // Current K-line entity length
Valeur de l'arcosine.
ACOS(X), returns the arccosine of X.
Remarks:
1.X takes values in the range [-1, 1].
2.If X is not in the range, the return value is null.
Example 1:
ACOS(-1); // Find the arccosine value of -1
Example 2:
ACOS(1); // Find the arccosine value of 1
Valeur de l'arcsin.
ASIN(X), returns the arcsine value of X.
Remarks:
1.X takes values in the range [-1, 1].
2.If X is not in the range, the return value is null.
Example 1:
ASIN(-1); // Find the arcsine value of -1
Example 2:
ASIN(1); // Find the arcsine value of 1
La valeur de l'Arctangent.
ATAN(X), returns the arctangent value of X.
Remark: X takes the value of R (the set of real numbers).
Example 1:
ATAN(-1.75); // Find the arctangent value of -1.75
Example 2:
ATAN(1.75); // Find the arctangent value of 1.75
Rassemblez-vous.
CEILING(X,Y), returns the first value of the specified real number (X) that divides the base number (Y) in the direction of increasing absolute value.
Remarks:
1.If the X and Y symbols are the same, the value is rounded away from 0.
2.In case of different X and Y symbols:
(1)If X is negative and Y is positive, the values are rounded upward in the direction toward 0.
(2)If X is positive and Y is negative, CEILING returns null.
3.Both X and Y can be variables.
4.If any one of X and Y is null, the function returns null.
Example 1:
CEILING(2.1,1); // Obtain 3
Example 2:
CEILING(-8.8,-2); // Obtain -10
Example 3:
CEILING(CLOSE*1.01,1); // Find 1.01 times the closing price rounded up
Example 4:
CEILING(-7,2); // Obtain -6
Example 5:
CEILING(8,-2); // Return null
Cosine.
COS(X), returns the cosine of X.
Remarks:
1.X takes the value of R (the set of real numbers).
2.The value range is [-1, 1].
Example 1:
COS(-1.57); // Returns the cosine value of -1.57
Example 2:
COS(1.57); // Returns the cosine value of 1.57
La fonction cubique.
CUBE(X), returns the third power of X.
Example 1:
CUBE(4); // Find the cube of 4
Index.
EXP(X), find the X power of e.
Example 1:
C*EXP(0.01); // Find the closing price multiplied by 0.01 power of e
On arrondit.
FLOOR(A), rounding in the decreasing direction of the value.
Remark:
FLOOR(A) returns the nearest integer along the decreasing direction of the value of A. If A is an integer, then the return value is A.
Example 1:
FLOOR(2.1); // The return value is 2
Example 2:
FLOOR(-8.8); // The return value is -9
Example 3:
FLOOR(5); // The return value is 5
Ex