Wenn während des Zeitraums andere Signale erscheinen, wird N neu berechnet. 4、N kann nicht als Variable geschrieben werden.
example:
C>O,BK(1);//K line is the rising line, buy long 1 hand
C<O,SP(BKVOL);//K line is a falling line, sell the long position to close the position
TRADE_AGAIN(3);//The same command line can be executed 3 times in a row (if three consecutive rising lines, three consecutive long positions are opened)
```
Rückgabe des Datenvertrags des letzten Kaufsignalpreises
BKPRICE returns the price of the last buying signal of the data contract.
usage:
BKPRICE returns the latest price of the market when the data was last issued.
Note:
1、When the data contract and the transaction contract are the same, the BKPRICE value is equal to the BKPRICE1 value.
2、When there are multiple open positions (adding positions) in the model, the function returns the price of the last open signal, not the average price of the open position.
3、Different signal execution modes, the return values are:
(1)Signal execution mode is not signal review
Historical backtest: BKPRICE return signal when the data contract price is the latest price
(2)Signal execution mode selection K line completion confirmation signal order
Historical backtest: BKPRICE return signal when the data contract is the closing price of the current K line
(3)Signal execution mode is set to K line to complete signal review
Historical backtest: BKPRICE return signal when the data contract is the closing price of the current K line
example:
BKPRICE-CLOSE>60 && BKPRICE>0 && BKVOL>0, SP; //If the buy price is 60 higher than the current price, and the long position exists, sell the position (closing position).
Durchschnittlicher Kurs der langen Position des Rückgabevertrags
BKPRICEAV returns the average price of long position for data contracts.
usage:
BKPRICEAV returns the average price of long position for data contracts.
Note:
1、One opening position and one closing position signal filtering model:
(1) After the opening position signal is issued, when the closing signal is not issued: the value of BKPRICEAV is the same as the value of BKPRICE.
(2) After closing position signal: BKPRICEAV returns a value of 0.
2、Adding and subtracting position models:
(1)When the position is not 0: BKPRICEAV returns the average price of the opening position of the data contract (theoretically).
(2)When the adding or subtracting position model is 0: BKPRICEAV returns 0.。
Note:
The calculation of this function takes into account the slippage of price.
example:
CLOSE-BKPRICEAV>60,SP(BKVOL);//The current price is 60 higher than the average price of the long position, and all the long positions are closed.
Kaufen Sie ein Signal für eine lange Eröffnungsposition
Buy long opening position signal lot
usage:
BKVOL returns the current theoretical long position of the model.
1、loading and running:
(1)During the backtesting system operation, BKVOL is not subject to the restriction of funds, and the number of open positions is displayed according to the signal.
2、In the back test run:
(1)If the funds are not enough to open the position, the open lot size is 0, and the BKVOL return value is 0.
(2)After the BK (BPK) signal appears and the signal is confirmed, the value of BKVOL increases the value of the number of opening positions; after the SP (SPK) signal appears and the signal is confirmed, the value of BKVOL decreases the value of the number of closing positions.
example:
BKVOL=0&&C>O,BK(1);//The theoretical long position is 0 and the closing price is greater than the opening price, buy long 1 hand
BKVOL>=1&&H>HV(H,5),BK(2); //The long position is greater than or equal to 1, and when the highest price of the current K line is greater than the highest of the previous 5 periods, 2 positions are added.
BKVOL>0&&L<REF(L,5),SP(BKVOL); //The long position is greater than 0, and when the lowest price of current K line is less than the lowest price of the K line of the previous 5 periods, sell all long positions (close position)
Rückgabe des höchsten Preises seit dem lang gekauften Datenvertrag (eröffnete lange Position)
Return the highest price since the data contract was bought (opened a long position)
usage:
BKHIGH returns the highest price of the most recent model opened long position to the current.
1、Different signal execution modes, the return values are:
(1)Signal execution mode is to order the K line to confirm the signal
a.In the historical signal calculation, the K line after the BK (BPK) signal returns the highest price of the data contract quote since the order sent.
b.During the loading operation, the BK (BPK) signal returns the latest price of the data contract quote when the signal is sent from the current K line, and the highest price of the data contract quote since the K line after the BK is returned.
The highest price of the statistical contract market is started when the BK (BPK) signal is sent; when the signal disappears, and the highest price of the data contract quote since the last purchase is returned. The signal confirms the existence and returns the highest data contract price recorded as the current K line.
Note: After the BK signal is sent, the signal disappears in the middle, and the highest price of the statistical contract starts from the last signal.
(3)Signal execution mode selection does not perform signal review (for example: writing MULTSIG in the model)
The current K line of the BK (BPK) signal returns the highest price of the data contract from the signal to the K line; the highest price of the data contract since the K line return signal after the BK (BPK) signal.
example:
C>O,BK;
C>BKPRICE&&C<BKHIGH-5,SP;
AUTOFILTER;//The latest price is lower than the highest price of the data contract since the buying long of the open position 5 points, take profit and close the position.
Rückgabe des niedrigsten Preises seit dem Kauf des Datenvertrags (eröffnete Long-Position).
Returns the lowest price since the data contract was bought (opened a long position).
usage:
BKLOW returns the data model's most recent model buy position to the current lowest price.
1、Different signal execution modes, the return values are:
(1)The K line goes through the confirmation signal to place an order
a.In the historical signal calculation, the K line after the BK (BPK) signal returns the lowest price of the data contract quote since the commission
b.During the loading operation, the BK (BPK) signal returns the latest price of the data contract quote when the signal is sent from the root K line, and the lowest price of the data contract quote since the K line after the BK is returned.
When the BK (BPK) signal is sent, the lowest price of the statistical contract market is started; the signal disappears, and the lowest price of the data contract quote since the last purchase is returned. The signal confirms the existence and returns the data contract price recorded as the root K line.
Note: After the BK signal is sent, the signal disappears in the middle, and the lowest price of the statistical contract starts from the last signal.
(3)Signal execution mode selection does not perform signal review (for example: writing MULTSIG in the model)
The lowest price of the data contract quote when the BK (BPK) signal returns from the signal to the K line when the K line returns; the lowest price of the data contract quote since the K line return signal after the BK (BPK) signal.
example:
C>O,BK;
C>BKLOW+5,SP;
AUTOFILTER;//The latest price is higher than the lowest price of the data contract since buying long position 5 points, close the position.
Gibt den letzten Preis des Datenvertrags zurück, der kurz verkauft wird
SKPRICE returns the price of the most recent sell short signal for the data contract.
usage:
SKPRICE returns the latest price of the market quotes when the last selling short signal was issued.
Note:
1、The SKPRICE value is equal to the SKPRICE1 value when the data contract and the trading contract are the same.
2、When there are multiple open positions (adding positions) signal in the model, the function returns the price of the last opening position signal, not the average price of the opening position.
3、Different signal execution modes, the return values are:
(1)Signal execution mode is not signal review
a.Historical backtest: the latest price of the data contract quote when the SKPRICE return signal is sent
(2)Signal execution mode selection K line completion confirmation signal order
a.Historical backtest: the closing price of the data contract when the SKPRICE return signal is issued as the current K line
(3)Signal execution mode is set to K-line to complete signal review
a.Historical backtest: the closing price of the data contract when the SKPRICE return signal is issued as the current K line
example:
CLOSE-SKPRICE>60 && SKPRICE>0 && SKVOL>0, BP; //If the selling price is 60 lower than the current price, and the short position exists, buy to cover. (close the position)
Durchschnittlicher Kurs der Kurzposition bei Rücklaufdaten
SKPRICEAV returns the average price of open contracts for data contracts.
usage:
SKPRICEAV returns the average price of the open contract for the return data contract.
Note:
1、One open and close position signal filtering model:
(1)When the opening signal is issued, the closing signal doesn’t appear, the SKPRICEAV value is the same as the SKPRICE value.
(2)After the closing signal is appeared: SKPRICEAV returns 0.
2、Add and subtract position models:
(1)When the position is not 0: SKPRICEAV returns the average price of the opening position of the data contract (theoretically).
(2)When the plus or minus position model position is 0: SKPRICEAV returns 0.
Note:
The calculation of this function takes into account the slippage of price.
example:
SKPRICEAV-CLOSE>60, BP(SKVOL);//The current price is 60 lower than the average price of short positions, closing all short positions
Verkauf von Short-Open-Positions-Signalpartien
Selling short open position signal lot
usage:
SKVOL returns the model's current short position theoretical position.
1、loading and running:
(1)During the operation of the backtesting system, SKVOL is not subject to the restriction of funds, and the number of open positions is displayed according to the signal.
2、In the backtest run:
(1)If the funds are not enough to open the position, the number of open positions is 0, and the return value of SKVOL is 0.
(2)After the SK (SPK) signal appears and signal is confirmed, the value of SKVOL increases the value of the number of opening positions; after the BP (BPK) signal appears and the signal is confirmed, the value of SKVOL is reduced by the number of the closing positions.
example:
SKVOL=0&&C<O,SK(1);//when the short position is 0 and the closing price is less than the opening price, sell short 1 hand.
SKVOL>=1&&L<LV(L,5),SK(2); //The short position is greater than or equal to 1, and when the lowest price of the root K line is less than the lowest of the lowest of the previous 5 periods, the 2 positions are added.
SKVOL>0&&H>REF(H,5),BP(SKVOL); //The short position is greater than 0, and when the highest price of the K line is greater than the highest price of the K line of pervious 5 cycles, buy to cover all short positions (close all short position)
Rückgabe des höchsten Preises seit dem Leerverkauf des Datenvertrags (eröffnete Leerposition)
Returns the highest price since the data contract was short sell (opened a short position)
usage:
SKHIGH returns the data contract the most recent model sell short position to the current highest price.
1、Different signal execution modes, the return values are:
(1)The K line goes through the confirmation signal to place an order
a.In the historical signal calculation, the K line after the SK (SPK) signal returns the highest price of the data contract quote since the order sent
b.During the loading operation, the SK (SPK) signal returns the latest price of the data contract when the signal is sent from the current K line, and the highest price of the data contract quoted since the K line after the SK returns.
The highest price of the statistical contract market is started when the SK (SPK) signal is sent; when the signal disappears, the highest price of the data contract quote since the last sale is returned. The signal confirms the existence and returns the highest data contract price recorded as the current K line.
Note: After the SK signal is sent, the signal disappears in the middle, and the highest price of the statistical contract starts from the last signal.
(3)Signal execution mode selection does not perform signal review (for example: writing MULTSIG in the model)
The highest price of the data contract market when the SK (SPK) signal returns from the signal to the K line when the K line returns; the highest price of the data contract since the K line return signal after the SK (SPK) signal.
example:
C<O,SK;
C<SKHIGH-5,BP;
AUTOFILTER;//The latest price is lower than the highest price of the data contract since the sale of open positions 5 points, close the position.
Gibt den niedrigsten Preis zurück, seitdem der Datenvertrag kurz verkauft wurde (eine Leerposition eröffnet wurde)
Returns the lowest price since the data contract was selling short (opened a short position)
usage:
SKLOW returns the data contract last time the model was selling short to the current lowest price.
1、Different signal execution modes, the return values are:
(1)The K line goes through the confirmation signal to place an order
a.In the historical signal calculation, the K line after the SK (SPK) signal returns the lowest price of the data contract quote since the order sent
b.During the loading operation, the SK (SPK) signal returns the latest price of the data contract quote when the signal is sent from the current K line, and the lowest price of the data contract quote since the return of the SK line after the SK line.
When the signal is sent, the lowest price of the statistics contract is started. The signal disappears and returns the lowest price of the data contract since the last sale. The signal confirms the existence and returns the lowest price of the data contract quoted by the K-line.
Note: After the SK signal is sent, the signal disappears in the middle, and the lowest price of the statistical contract starts from the last signal.
(3)Signal execution mode selection does not perform signal review (for example: writing MULTSIG in the model) The lowest price of the data contract market when the SK (SPK) signal returns from the signal to the K line when the K line returns; the lowest price of the data contract after the K line return signal after the SK (SPK) signal
example:
C<O,SK;
C<SKPRICE&&C>SKLOW+5,BP;
AUTOFILTER;//The latest price is higher than the lowest price of the data contract since the sale of open positions 5 points, stop profit and close the position.
Bestimmen, ob das vorherige Signal BK ist
ISLASTBK determines if the last trading signal is BK.
usage:
ISLASTBK returns 1 (Yes) when the previous trading signal is BK, otherwise returns 0 (No)
ISLASTBK returns a value of 0 when the BK signal is not acknowledged;
ISLASTBK returns 1 after the BK signal is confirmed
b.Signal execution mode selection does not perform signal review (for example: writing MULTISIG in the model), BK signal returns the value as current ISLASTBK
Note: When the model contains BPK conditions, and the previous signal is the close position signal, the BK signal generated by the BPK instruction, ISLASTBK returns 0, and ISLASTBPK returns 1.
example:
C>O,BK;
ISLASTBK&&C>BKPRICE,SP;
AUTOFILTER;//The last signal is the BK signal, and the latest price is greater than the opening price, selling the position (close position)
Bestimmen, ob das letzte Signal SK ist
ISLASTSK determines if the last trading signal is SK.
usage:
ISLASTSK returns 1 (Yes) when the last trading signal is SK, otherwise returns 0 (No)
ISLASTSK returns a value of 0 when the SK signal is not acknowledged;
ISLASTSK returns 1 after SK signal is confirmed
b.Signal execution mode selection does not perform signal review (for example: writing MULTISIG in the model), SK signal when the current ISLASTSK returns a value of 1
Note: When the model contains SPK conditions, and the previous signal is the close position signal, the SK signal generated by the SPK instruction, ISLASTSK returns 0, ISLASTSPK returns 1.
example:
C<O,SK;
ISLASTSK&&C<SKPRICE,BP;
AUTOFILTER;//the last signal is SK signal, and the latest price is less than the opening price, buy to cover (close position)
Bestimmen, ob das vorherige Signal BP ist
ISLASTBP determines if the last trading signal is BP.
usage:
ISLASTBP returns 1 (Yes) when the last trading signal is BP, otherwise returns 0 (No)
ISLASTBP returns a value of 0 when the BP signal is not acknowledged;
After the BP signal is confirmed, ISLASTBP returns 1
b.The signal execution mode is selected without signal review for example: writing MULTISIG in the model), and the BP signal returns a value of 1 when the current ISLASTBP returns
example:
C<O,SK(2);
C>O,BP(1);
ISLASTBP,BP(1);//The last signal is to buy to cover signal (close position), then subtract 1 hand position.
Bestimmung, ob das vorherige Signal SP ist
ISLASTSP determines if the last trading signal is an SP.
usage:
ISLASTSP returns 1 (Yes) when the previous trading signal is SP, otherwise returns 0 (No)
ISLASTSP returns a value of 0 when the SP signal is not acknowledged;
ISLASTSP returns 1 after the SP signal is confirmed
b.The signal execution mode is selected without signal review (for example: writing MULTISIG in the model), and the SP signal returns a value of 1 when the current ISLASTSP returns
example:
C>O,BK(2);
C<O,SP(1);
ISLASTSP,SP(1);//the last signal is the closing position signal, subtract 1 hand position
Bestimmen, ob das vorherige Signal BPK ist
ISLASTBPK determines if the last trading signal is BPK.
usage:
ISLASTBPK returns a 1 (Yes) on BPV, but returns 0 (No)
ISLASTBPK returns a value of 0 when the BPK signal is not acknowledged;
After the BPK signal is confirmed, ISLASTBPK returns 1
b.Signal execution mode selection does not perform signal review (for example: writing MULTISIG in the model), BPK signal returns the value as current ISLASTBPK
Note: When the model contains BPK conditions, and the previous signal is the close position signal, the BK signal generated by the BPK instruction, ISLASTBK returns 0, and ISLASTBPK returns 1.
example:
C>O,BPK;
ISLASTBPK&&C<O,SPK;
AUTOFILTER;//the last signal is BPK signal, then reverse SPK
Bestimmung, ob das vorherige Signal SPK ist
ISLASTSPK determines if the last trading signal is SPK.
usage:
The last trading signal of ISLASTSPK is 1 (Yes) for SPK, otherwise it returns 0 (No)
ISLASTSPK returns a value of 0 when the SPK signal is not acknowledged;
ISLASTSPK returns 1 after SPK signal is confirmed
b.Signal execution mode selection does not perform signal review (for example: writing MULTISIG in the model), SPK signal when the current ISLASTSPK returns a value of 1
Note: When the model contains SPK conditions, and the previous signal is the close position signal, the SK signal generated by the SPK instruction, ISLASTSK returns 0, ISLASTSPK returns 1.
example:
C<O,SPK;
ISLASTSPK&&C>O,BPK;
AUTOFILTER;//the last signal is SPK signal, then reverse BPK
Feststellen, ob das vorherige Signal STOP ist
ISLASTSTOP determines if the last trading signal is STOP.
usage:
ISLASTSTOP returns 1 (Yes) when the last trading signal is STOP, otherwise returns 0 (No)
Note: The closing price model STOP signal has a return value of 1 for the K-line ISLASTSTOP; the command price model STOP signal returns 1 for the current K-line ISLASTSTOP.
example:
CROSS(C,MA(C,5)),BK(2);
STOP(0,5);
ISLASTSTOP&&CROSS(C,MA(C,10)), BK(1);//The last signal is the STOP signal, and the price up cross the 10-cycle moving average line, opening a position(1 hand)
Feststellen, ob das vorherige Signal CLOSEOUT ist
ISLASTCLOSEOUT determines if the previous signal is CLOSEOUT.
usage:
ISLASTCLOSEOUT The last trading signal is CLOSEOUT returns 1 (Yes), otherwise it returns 0 (No)
ISLASTCLOSEOUT returns a value of 0 when the CLOSEOUT signal is not acknowledged;
ISLASTCLOSEOUT returns 1 after the CLOSEOUT signal is acknowledged
b. Signal execution mode selection does not perform signal review (for example: write MULTIC in the model), CLOSEOUT signal when the current ISLASTCLOSEOUT returns a value of 1
example:
ISLASTCLOSEOUT&&C>O, BK(1);//The last signal is the clearance signal, and when the current K line is the rising line, buy long 1 hand
Der letzte Kauf-Lange-Signalstandort
BARSBK last buy long signal location
usage:
BARSBK returns the number of cycles of the K line from the last buying long location to the current K line (excluding the K line where the BK signal appears)
To take the number of cycles from the K line that appears in the BK signal to the current K line, you need to +1 after this function, that is, BARSBK+1; since the current k line of the BK signal returns the null value, the BARSBK+1 When the BK signal is sent, the current k line returns a null value.
Note:
1、If there is no BK signal before the current K line, the function return value is null.
2、After the BK signal is confirmed, BARSBK returns a null value.
(1)Set the signal execution mode to order the K line to confirm the signal
The BARSBK return value is the number of the current K line from the previous BK signal (including the current K line)
(2)Set the signal execution mode to immediately place an order for the outgoing signal, without reviewing (for example, writing MULTSIG in the model)
a.In the historical signal calculation, the current K line of the BK signal appears, and the BARSBK returns a null value.
b.During the loading operation, BARSBK returns a null value after the signal is confirmed.
The BARSBK return value is the number of the current K line from the previous BK signal (including the current K line)
example:
1、BARSBK>10, SP; / / last time of buying long open positions (not including the K line that appears to the opening position signal) from the current K line cycle number is greater than 10, closing position;
2、HHV (H, BARSBK + 1); / / last time to selling short open positions (including the opening of the signal appears as the current k line) to the current maximum price.
When the BK signal appears on the current K line, AA returns a null value, and needs to return the highest price on the current K line. The model needs to be modified to:
AA:=IFELSE(BARSBK>=1,HHV(H,BARSBK+1),H);
(1)When the BK signal appears on the current K line, the BARSBK returns a null value, and if the condition of BARSBK>=1 is not satisfied, the value is the highest price of the current K line.
(2)After the BK signal is sent, the K line BARSBK returns the number of cycles of the K line of the open position from the current K line. If the condition of BARSBK>=1 is satisfied, the value is HHV(H, BARSBK+1), that is, the open position is buying long. (Includes the current k line that appears when the opening signal appears) to the current maximum price.
After the modification, if the value of AA is used in the closing position condition, when the current K line satisfies the closing position condition, the closing signal may appear.
3、AA:=IFELSE(BARSBK>=1,REF(C,BARSBK),C);//take the latest buying long position of the K-line closing price
(1)When the current k-line BARSBK of the BK signal returns a null value, when the current K-line does not satisfy the condition of BARSBK>=1, AA returns the closing price of the current k-line;
(2)After the BK signal is sent, the k line BARSBK returns the number of cycles of the K line of the open position from the current K line, then AA returns REF (C, BARSBK), that is, the closing price of the opened position k line;
(3)Example: 1, k2, 3, 3, k line, 1 K line is the current k line of the opening signal, then return the closing price of the current k line, 2, 3 K line AA return value is 1 K line Closing price.
Standort des letzten verkauften Kurzsignales
BARSSK last selling short signal location
usage:
BARSSK returns the number of cycles from the K line of the last sell short open position to the current K line (excluding the K line where the SK signal appears)
Take the number of cycles from the K line that appears in the SK signal to the current K line, which needs to be +1 after this function, that is, BARSSK+1; since the current k line BARSSK that sends the SK signal returns a null value, BARSSK+1 is The SK signal is sent when the current k line returns a null value.
Note:
1. If there is no SK signal before the current K line, the function return value is null.
2. After the SK signal is confirmed, BARSSK returns a null value.
(1) Set the signal execution mode to order the K line to confirm the signal
The BARSSK return value is the number of the current K line from the previous SK signal (including the current K line)
(2) Set the signal execution mode to immediately place an order for the outgoing signal, without reviewing (for example, writing MULTSIG in the model)
a. In the historical signal calculation, the SK signal appears as the current K line, BARSSK returns a null value
b. During the loading operation, the SK signal is the current K line, and the BARSKK returns a null value after the signal is confirmed.
The BARSSK return value is the number of the current K line from the previous SK signal (including the current K line)
example:
1, BARSSK>10, BP; / / last selling short open position (excluding the K line that appears to buy long signal) from the current K line cycle number is greater than 10, close position;
2, LLV (L, BARSSK + 1); / / last selling short position (including the opening k signal appears as the current k line) to the current minimum price.
When the SK signal appears on the current K line, AA returns a null value. If it is necessary to return the lowest price on the current K line, the model needs to be modified to:
AA:=IFELSE(BARSSK>=1, LLV(L, BARSSK+1), L);
(1) When the SK signal appears on the current K line, BARSSK returns a null value. If the condition of BARSSK>=1 is not satisfied, the value is the lowest price of the current K line.
(2) After the SK signal is sent, the K line SARSK returns the number of cycles of the K line that selling short position from the current K line. If the condition of BARSSK>=1 is satisfied, the value is LLV (L, BARSSK+1), that is, the selling short position (including the current k line that appears when the opening position signal appears) to the minimum value of the current lowest price.
After the modification, if the value of AA is used in the closing position condition, when the root K line satisfies the closing condition, the closing position signal may appear.
3, AA: = IFELSE (BARSSK> = 1, REF (C, BARSSK), C); / / take the closing price of the last selling short K line
(1) When the current k-line BARSSK of the SK signal returns a null value, when the current K line does not satisfy the condition of BARSSK>=1, AA returns the closing price of the current k-line;
(2) After the SK signal is sent, the k line BARSSK returns the number of cycles of the K line of the open position from the current K line, then AA returns REF (C, BARSSK), that is, the closing price of the opened k line;
(3) Example: 1, 2, 3 k line, 1 K line is the current k line of the opening signal, then return the closing price of the current k line, 2, 3K line AA return value is the closing price of 1K line.
Standort des letzten Verkaufs bis zum Abschluss der Position
BARSSP last sell to close position location
usage:
BARSSP returns the number of cycles of the last K line that was selling short from the current K line (excluding the K line where the SP signal appears)
To take the number of cycles from the K line that appears in the SP signal to the current K line, you need to +1 after this function, that is, BARSSP+1. Since the current k-line BARSSP of the SP signal returns a null value, BARSSP+1 is issuing the SP signal when the current k line returns a null value.
Note:
1、If there is no SP signal before the current K line, the function return value is null.
2、After the SP signal is confirmed, BARSSP returns a null value.
(1)Set the signal execution mode to order the K line to confirm the signal
The BARSBP return value is the number of the current K line from the previous BP signal (including the current K line)
(2)Set the signal execution mode to immediately place an order for the outgoing signal, without reviewing (for example, writing MULTSIG in the model)
a.In the historical signal calculation, the SP signal appears as the current K line, and the BARSSP returns a null value.
b.During the loading process, when the signal is confirmed, the BARSSP returns a null value.
The BARSSP return value is the number of the current K line from the previous SP signal (including the current K line)
example:
1、BARSSP>10, BK; / / last selling short close position (not including the K line that appears closing position signal) from the current K line cycle number is greater than 10, buy long.
2、AA: = HHV (H, BARSSP + 1); / / Last time, the sell short of the closing position (including the current k line appearing in the closing signal) to the current maximum price maximum.
When the SP signal appears on the current K line, AA returns a null value. If it is necessary to return the highest price on the current K line, the model needs to be modified to:
AA:=IFELSE(BARSSP>=1,HHV(H,BARSSP+1),H);
(1)When the SP signal appears on the current K line, the BARSSP returns a null value, and if the condition of BARSSP>=1 is not satisfied, the value is the highest price of the current K line.
(2)After the SP signal is sent, the K-line BARSSP returns the number of cycles of the K-line of the buy long position from the current K-line. If the condition of BARSSP>=1 is satisfied, the value is HHV(H, BARSSP+1), that is, the sale is closed. (including the root k line appearing when the closing signal appears) to the maximum value of the current highest price.
3、AA:=IFELSE(BARSSP>=1,REF(C,BARSSP),C);//take the closing price of the last sale of closed K-line
(1)When the current signal of the SP signal returns the null value, the current K line does not satisfy the condition of BARSSP>=1, and AA returns the closing price of the current k line;
(2)After the SP signal is sent, the k line BARSSP returns the number of cycles of the K line of the selling position from the current K line, then AA returns REF (C, BARSSP), that is, the closing price of the closing k line;
(3)1, 2, 3 k line, 1 K line is the current k line of the closing position signal, then return the closing price of the current k line, 2, 3 K line AA return value is the closing price of 1 K line
Letztes Mal kaufte ich, um den Signalstandort abzudecken.
BARSBP last time buy to cover signal location
usage:
BARSBP returns the number of cycles from the last K line of the last buy to cover position to the current K line (excluding the K line where the BP signal appears)
To take the number of cycles from the K line that appears in the BP signal to the current K line, you need to +1 after this function, that is, BARSBP+1. Since the current k-line BARSBP of the BP signal returns a null value, BARSBP+1 is issuing a BP signal when the current k line returns a null value.
Note:
1、If there is no BP signal before the current K line, the function return value is null.
2、BARSBP returns a null value after the BP signal is confirmed.
(1)Set the signal execution mode to order the K line to confirm the signal
The BARSBP return value is the number of the current K line from the previous BP signal (including the current K line)
(2)Set the signal execution mode to immediately place an order for the outgoing signal, without reviewing (for example, writing MULTSIG in the model)
a. In the historical signal calculation, the BP signal appears as the current K line, and the BARSBP returns a null value.
b.During the loading operation, the BP signal is current at the K line, and the BARSBP returns a null value after the signal is confirmed.
The BARSBP return value is the number of the current K line from the previous BP signal (including the current K line)
example:
1、BARSBP>10,BK;//last time to buy to cover a position (not including the K line that appears to buy to cover signal) from the current K line cycle number is greater than 10, buy long.
2、AA:=HHV(H,BARSBP+1);//last time to buy to cover a position (including the current k line appear when the closing signal appears) to the current maximum price.
When the BP signal appears on the current K line, AA returns a null value. If it is necessary to return the highest price on the current K line, the model needs to be modified to:
AA:=IFELSE(BARSBP>=1,HHV(H,BARSBP+1),H);
(1)When the BP signal appears on the current K line, the BARSBP returns a null value, and if the condition of BARSBP>=1 is not satisfied, the value is the highest price of the current K line.
(2)After the BP signal is sent, the K-line BARSBP returns the number of cycles of the K-line of the buy long position from the current K-line. If the condition of BARSBP>=1 is satisfied, the value is HHV(H, BARSBP+1), that is, the long position is closed. (including the current k line appearing when the closing signal appears) to the maximum value of the current highest price.
3、AA:=IFELSE(BARSBP>=1,REF(C,BARSBP),C);//take the closing price of the last buy to cover closing position K line
(1)When the current k-line BARSBP of the BP signal returns a null value, when the current K line does not satisfy the condition of BARSBP>=1, AA returns the closing price of the current k-line;
(2)After the BP signal is sent, the k-line BARSBP returns the number of cycles of the K-line of the buy long position from the current K-line, then AA returns REF(C, BARSBP), that is, the closing price of the closed k-line;
(3)Example: 1, 2, 3 k line, 1 K line is the current k line of the closing signal, then return the closing price of the current k line, 2, 3 K line AA return value is 1 K line Closing price.
Holen Sie sich die Anzahl der gesendeten Bestellungen.
MYVOL Get the number of sent orders
Usage: Get the number of sent orders, which is used to calculate the lot size when loading the model, which include adding or subtracting positions.
Note:
Backtest: return the number of lots number in the backtest parameter
example:
//When the number of orders in the loading parameters is set to 3, the number of orders for writing BK is 6;
C>O,BK(2*MYVOL);
C<O,SP(BKVOL);
Auf dem Konto verfügbare Mittel
MONEY account available funds
Usage: MONEY returns the funds available for the account, used for calculation of positions, lots, etc.
Calculation method:
1. The initial value of MONEY in the account is the starting capital set in the margin parameter.
2. The initial value of MONEY in the historical backtest is the initial capital set in the backtest parameter.
3. Open the position signal as the MONEY value of the current k line: available funds before opening the position - position margin – commission fee, where position margin = opening price * margin ratio * trading unit * lot
4. MONEY value of the k line that has not been closed after opening the position = MONEY value of the k line before the opening signal + floating profit and loss PROFIT
5. The MONEY value of the closing signal as the current k line: the available funds before closing the position + the closing profit and loss + the margin released by the closing position - the commission fee, wherein the margin released by the closing position = the opening price * the margin ratio * the trading unit * the number of lots
Note:
1. The signal execution mode is: ‘K line is finished confirming the order’ or ‘XX is placed, K line is finished reviewing’:
a. Open the signal as the current K line, MONEY return value is the available funds of the upper current K line - open margin – commission fee.
b. The closing signal is the current K line, the MONEY return value is the available capital of the upper K line + the closing profit and loss + the margin released by the position - the commission fee.
2. Signal execution mode selection, ‘Outgoing signal is placed, no review is performed’:
a. Opening the signal When the current K line, the MONEY return value is the available funds before the opening of the k-line - opening margin – commission fee.
b. The closing signal is the current K line, and the MONEY return value is the available funds before the closing of the K line and the closing profit/loss of the closing position + the margin for releasing the position.
3. When the signal execution mode is ‘K line completes the confirmation signal to place an order’, the closing profit and loss = (closing price as the closing price of the K-line closing price - opening price) * lot number * trading unit - handling fee.
4. The signal execution mode is ‘When the signal is placed immediately, no review is made, the profit and loss of the position is closed==the order price of the closing signal-opening price*the number of lots* the trading unit-commission fee.
5. After the account is initialized, the MONEY return value is the available funds in the initialization box.
example:
K:=GELD0,2/(CMARGIN*UNIT+FEE); // 20% der für das Konto verfügbaren Mittel können geöffnet werden (dies ist das gleiche wie der Vertrag für ein festes Los), Gebühren benutzerdefiniert oder Berechnung. Ich bin nicht hier.
Eigenkapital auf dem Konto
MONEYTOT Account equity
Usage: MONEYTOT returns the current account equity, and the model is used for fund management such as position control and order lot size.
Calculation method: MONEYTOT=Account available funds + position margin
Note:
example:
K:=MONEYTOT*0.2/(C*MARGIN*UNIT+FEE); // 20% of the account equity can be opened (this is the same as the contract for a fixed lot), FEE customization, or calculation
```
Verfügbare Währung für das Kryptowährungs-Spotkonto
1、For cryptocurrency spot, get the current available currency.
Verschuldung
Futures für Rohstoffe
a := MARGIN; // Declare the variable a and assign a to the current contract leverage.
Kryptowährungs-Spot
a := MARGIN; // fixed to a value of 1
Futures für Kryptowährungen
Futures für Kryptowährungen
a := MARGIN; // Declare the variable a and assign a to the current contract leverage.
Erhalten Sie den letzten Verkaufspreis von TICK
Holen Sie sich den zweiten letzten Verkaufspreis von TICK
Erhalten Sie den dritten letzten Verkaufspreis von TICK.
Erhalten Sie den vierten letzten Verkaufspreis von TICK
Erhalten Sie den fünften letzten Verkaufspreis von TICK.
Erhalten Sie das Volumen des letzten Verkaufspreises
Erhalten Sie das Volumen des zweiten letzten Verkaufspreises
Erhalten Sie das Volumen des dritten letzten Verkaufspreises
Erhalten Sie das Volumen des vierten letzten Verkaufspreis
Holen Sie sich das Volumen des fünften letzten Verkaufspreis
Erhalten Sie den neuesten Kaufpreis von TICK
Erhalten Sie den zweiten letzten Kaufpreis von TICK
Erhalten Sie TICK's dritten letzten Kaufpreis
Erhalten Sie den vierten letzten Kaufpreis von TICK
Erhalten Sie den fünften letzten Kaufpreis von TICK
Holen Sie sich das Volumen des letzten Kaufpreises
Erhalten Sie das Volumen des zweiten letzten Kaufpreises
Erhalten Sie das Volumen des dritten letzten Kaufpreises
Erhalten Sie das Volumen des vierten letzten Kaufpreises
Holen Sie sich das Volumen des fünften letzten Kaufpreises
Holen Sie sich den neuesten Preis von TICK
Aussteigen aus dem Programm
EXIT();
Ausgabe des Protokolls
INFO(cond, param, ...);
1、cond is a condition variable and output log when it is true.
2、The condition variable can be followed by multiple variable parameters.
example:
INFO(1, C, '<-closing price');