Inventors quantify My language (Mylang) documentation

Author: The Little Dream, Created: 2018-11-30 13:29:33, Updated: 2022-12-09 17:46:10

[TOC]

My language is a programmed transaction language that is compatible with and enhanced by Ma. FMZ-quantized My language performs strict syntax checks, such as when using language enhancement embedded in JavaScript language code.%%An error is generated if the operator is followed by more than one space character.

  • Basic information

    • The Contract

      The digital currency contract

      The digital currency contract

      this_week     数字货币期货当周合约
      next_week     数字货币期货次周合约
      month         数字货币期货月度合约
      quarter       数字货币期货季度合约
      next_quarter  数字货币期货次季度合约
      third_quarter 数字货币期货第三季度合约
      last_quarter  最后季度合约
      
      XBTUSD        BITMEX永续合约
      swap          除BITMEX交易所以外数字货币期货永续合约
      
      具体可以参看JavaScript/Python/C++文档的exchange.SetContractType()函数部分
      

      img

    • Variable

      A variable is a piece of space in a computer's memory that is used to store data.

      Open the first variable

      // 将1赋值给变量a
      a:=1;
      

      In the麦语言In and out数据量This is a simple distinction:

      1. Single-value data: only one value, for example01’abc’
      2. Sequential data: A data sequence consisting of a single-valued data set, e.g.Close(Closing price), hereCloseIncludesnThe closing price of the cycle[ 10.1 , 10.2 , 10.3 , 10.4 , 10. 5 ...]

      Distinguish from variable-type silicon

      1. String type: must be used''Packages, string types are not allowed to be used directly, and function output to the view is required.
      INFO(CLSOE>OPEN,'OK!');
      
      1. Numerical types: Includes integers, floating point numbers (comma) ⇒
      // 整数
      int:=2;
      
      // 小数
      float:=3.1;
      
      1. Boolean type, using 1 (to represent true) or 0 (to represent false):1, 0, true or false; for example:A:=1>0;After the execution of the code, the user will be able to access the file.AThe value is 1⁄4.
      // 当前周期收盘价大于-999,你会发现,每个周期的返回值都是1,代表true,因为收盘价几乎不可能为负数
      is_true:=Close>-999;
      
      1. Global variables
      VARIABLE:VALUE1:10;     // 声明一个全局变量,赋值为10,只执行一次。
      

      When retesting, please note:

      VARIABLE:NX:0;    // 初始一个全局变量NX为0
      NX..NX+1;         // 每次累加1
      INFO(1,NX);       // 每次打印NX
      

      At firstINFOThe sentence is printed:101I think it's a good idea to start with the first one.0What? The reason is that the initial K-line has 100 at the time of retesting, has been run over 100 K-lines, and added 100 times. The real disk depends on how many K-strings are initially obtained.

      • Naming rules

        In most systems, variable names do not allow the use of system names for reserved words (e.g. built-in variable names, function names).CloseCIn addition, no pure numbers or numerical beginnings are allowed. No very long endings are allowed, with different system length limits. In fact, you don't have to confuse the mainstream system for the efficiency of Chinese resolution, believing that the Oolong language is very friendly to Chinese.

        1. Chinese name
        // 优雅的输出
        五日均线:=MA(C,5);
        
        1. English+ underlined
        // 输出
        move_avg_5:=MA(C,5);
        

        If you prefer English, make it as easy as possible for people to understand the meaning of your variables.A1AAABBB...this kind of naming. I'm sure you'll be very pained by the lack of memory when you revisit your indicator code again in the future.

        So from now on, embrace the Yum Yum language as much as possible! May it be a powerful tool for your analysis and decision-making.

    • Type of data

      A data type is a basic concept that when we assign a definite data value to a variable in writing, the variable becomes the type of the data itself.

        1. Type of number:
        1、2、3、1.1234、2.23456 ...
        
        1. String type ((str):
        '1' 、'2' 、'3' ,字符串类型必须用 '' 包裹
        
        1. Sequence data:
        一系列单值数据构成的数据集合
        
        1. Boolean type:

        Use it1Representativestrue0Representativesfalse

        Examples

        // 声明一个数值类型的变量
        var_int := 1;
        // 声明一个序列数据的变量
        var_arr := Close;
        // 字符串类型不能单独声明,需要结合函数
        INFO(C>O, '阳线');
        
    • The operator

      The symbols that are used to perform the operations in the indicator code are simply the symbols that participate in the operations.

      • Assignment operator

        It's used to assign a value to a variable.

          1. :

          :, represents the assignment and is exported to the graph (subgraph).

          Close1:Close;      // 将Close赋值给变量Close1,并且输出到图中
          
          1. :=

          :=, represents an assignment, but is not exported to the graph (main graph, subgraph...) and is not shown in the status bar tables.

          Close2:=Close;     // 将Close赋值给变量Close2
          
          1. ^^

          ^^, two^The symbol represents the assignment, assigns the variable and outputs it to the graph.

          lastPrice^^C;
          
          1. ..

          .., two.Symbols represent assignments, give variable assignments and show variable names, numbers in the graph, but do not draw graphs in the graph (main graph, subgraph, etc.).

          openPrice..O
          
      • Relational operators

        The relational operator is a binary operator used in conditional expressions. It is used to judge the relationship between two data.

        Returns a value: Boolean type, nottrue(1) is equal tofalse(0)。

          1. Greater than>
          // 将2>1的运算结果赋值给rv1变量,此时rv1=1
          rv1:=2>1;
          
          1. Less than<
          // 返回false,也就是0,因为2大于1
          rv3:=2<1;
          
          1. is greater than or equal to>=
          x:=Close;
          // 将收盘价大于等于10的运算的结果赋值给变量rv2
          // 注意,由于close是一个序列数据,当进行close>=10运算的时候,本质是每个周期都进行运算,所以每个周期都会有一个1、0的返回值
          rv2:=Close>=10;
          
          1. Less than is equal to<=
          此处省略
          
          1. is equal to=
          A:=O=C;     // 判断开盘价是不是等于收盘价。
          
          1. is not equal to<>
          1<>2       // 判断1是否不等于2,返回值为1(true)
          
      • Logical operators

        Returns a value: Boolean type, nottrue(1) is equal tofalse(0)。

        1. Logic and&&You can useandAlternatively, both left and right sides of the connection must be formed simultaneously.
        // 判断 cond_a,cond_b,cond_c 是否同时成立
        cond_a:=2>1;
        cond_b:=4>3;
        cond_c:=6>5;
        cond_a && cond_b and cond_c;    // 返回值为1,成立
        
        1. Logic or||You can useorAlternate or link both sides to the left and right, one side is true, and the whole is true.
        cond_a:=1>2;
        cond_b:=4>3;
        cond_c:=5>6;
        cond_a || cond_b or cond_c;    // 返回值为1,成立
        
        1. ()Operator, which calculates the expression in parentheses first.
        1>2 AND (2>3 OR 3<5)    // 运算结果为假
        1>2 AND 2>3 OR 3<5      // 运算结果为真
        
      • Arithmetic operator

        返回值:数值类型
        

        Arithmetic operators are the symbols used to perform basic arithmetic operations.

        • Plus and plus

          A:=1+1;      // 返回 2
          
        • Subtract -

          A:=2-1;      // 返回 1
          
        • Multiply by *

          A:=2*2;      // 返回 4
          
        • Except for

          A:=4/2;      // 返回 2
          
    • Function

      • Function

        In the world of programming, a function call is a piece of code that implements a function; it can be called to other code in the following general form:

        function(param1,param2,...)
        
        • It consists of:

          Function names (parameters 1, 2,...) may have no parameters or multiple parameters. For example,MA(x,n);The representative returnsnwithin the cyclexThe simple moving average of the mean of the mean of the mean of the mean of the mean of the mean of the mean of the mean of the mean.MA()So this is a function.xandnThe parameters of the function.

          When using a function, we need to understand the basic definition of the function, i.e. what data can be obtained by calling the function. Usually, functions come with parameters, and when we pass a parameter, we need to ensure that the data type is in compliance. Most of the code suggestions of the IDE at this stage are very imperfect.MA(x,n);Explained as:

          返回简单移动平均
          用法:
          AVG:=MA(X,N): X的N日简单移动平均,算法(X1+X2+X3+...+Xn)/N,N支持变量
          

          This is very unfriendly for beginners. Next, we do a thorough analysis of the function, trying to find a quick way to learn and use the function.

      • Returns the value

        In order to quickly learn functions, we first need to understand a concept called "return value".Going backThe name means "return"; the value means "specific value", and the return value means "data that can be obtained".

        // 因为后面的代码中会用到,所以用变量 return_value 接收、保存 function()的返回值
        // retrun_value := function(param1,param2);
        // 例如:
        AVG:=MA(C,10);     // AVG即retrun_value,function函数即:MA函数,param1参数:C即收盘价序列数据,param2参数:10。
        
      • Parameters

        The second important concept of the second function is that parameters can be passed to different parameters to get different returns.

        // 变量ma5接收5日收盘价移动平均值
        ma5:=MA(C,5);
        // 变量ma10接收10日收盘价移动平均值
        ma10:=MA(C,10);
        

        The above variablesma5ma10The first parameter ofXAll of them.C(Closing price), actuallyCIt's also a function (which returns a sequence of opening and closing prices to date), but it has no parameters. The second parameter, 5, 10, is used to tellMA()Function, we want to get the moving average of the closing price for several days, through parameters, the function becomes more flexible to use.

      • How to Learn

          1. First, we need to understand the function's role, which is what data the function can return to us.
          1. The last thing is to understand the type of the return value, after all we are using functions to get the return value.
          1. And then we need to know the data type of the parameters.MA(x,n)If you don't know the parameters,xnThe data type of the data type is also not able to get the correct return value.

        The following functions are introduced, used, and followed by the above 3 principles.

    • Language enhancement

      • 麦语言andJavaScriptMixed language programming

        %%
        // 这里面可以调用发明者量化的任何API 
        scope.TEST = function(obj) {
            return obj.val * 100;
        }
        %%
        收盘价:C;
        收盘价放大100倍:TEST(C);
        上一个收盘价放大100倍:TEST(REF(C, 1)); // 鼠标移动到回测的K线上就会提示变量值
        
        • scopeObjects

          scopeObjects can add properties and assign anonymous functions to properties, and the anonymous function that the attribute is referenced to can be called in the Macrolanguage code section.

        • scope.getRefs(obj)Function

          In theJavaScriptIn the code block, callscope.getRefs(obj)The function returns the input.objThe object data.

          The following%% %%Embroidered with symbolsJavaScriptIn the code, you will get the Ma code.TEST(C)Input when a function is calledCThe closing price.scope.getRefsThe function returns all the closing prices of this K-line data.throw "stop"Interrupt the procedure.arrContains only the closing price of the first Bar.throw "stop"I'm going to execute.JavaScriptThe end of codereturnThis is a list of all the different ways The Price of Gold is Right is credited in the database.

          %%
          scope.TEST = function(obj){
              var arr = scope.getRefs(obj)
              Log("arr:", arr)
              throw "stop"
              return
          }
          %%
          TEST(C);
          
        • scope.bars

          In theJavaScriptAccess all K-bars in the code block.

          TESTThe function returns a value. 1 is the vaginal line, 0 is the solar line.

          %%
          scope.TEST = function(){
              var bars = scope.bars
              return bars[bars.length - 1].Open > bars[bars.length - 1].Close ? 1 : 0    // 只能返回数值
          }
          %%
          arr:TEST;                                                                      
          
          # 注意:
          # TEST接收的匿名函数,返回值必须是数值。
          # 如果匿名函数没有参数,在调用TEST的时候直接写VAR:=TEST;写VAR:=TEST();会报错。
          # scope.TEST中的TEST必须是大写。
          
        • scope.bar

          In theJavaScriptIn the code block, access the current bar.

          Calculate the average of the highest and lowest prices.

          %%
          scope.TEST = function(){
              var bar = scope.bar
              var ret = (bar.Open + bar.Close + bar.High + bar.Low) / 4
              return ret
          }
          %%
          avg^^TEST;
          
        • scope.depth

          Access market depth data (order low).

          %%
          scope.TEST = function(){
              Log(scope.depth)
              throw "stop"             // 打印一次深度数据后就抛出异常,暂停
          }
          %%
          TEST;
          
        • scope.symbol

          Get the current transaction for the name string.

          %%
          scope.TEST = function(){
              Log(scope.symbol)
              throw "stop"
          }
          %%
          TEST;
          
        • scope.barPos

          Get the position of the K-line Bar.

          %%
          scope.TEST = function(){
              Log(scope.barPos)
              throw "stop"
          }
          %%
          TEST;
          
        • scope.get_locals(‘name’)

          This function is used to retrieve variables in the Macrolanguage code section.

          V:10;
          %%
          scope.TEST = function(obj){
              return scope.get_locals('V')
          }
          %%
          GET_V:TEST(C);
          
          # 注意:
          # 如果某个变量,由于周期不足的时候计算不出数据,这个时候在JavaScript代码中调用scope.get_locals函数
          # 获取这个变量时,会报错:line:XX - undefined locals某个变量名undefined
          
        • scope.canTrade

          canTradeAttribute marks whether the current bar is tradable (if the current bar is the last bar)

          For example, judging when the strategy is in a tradable ordering state to print market data

          %%
          scope.LOGTICKER = function() {
              if(exchange.IO("status") && scope.canTrade){
                  var ticker = exchange.GetTicker();
                  if(ticker){
                      Log("ticker:", ticker);
                      return ticker.Last;
                  }
              }
          }
          %%
          LASTPRICE..LOGTICKER;
          
      • Examples of use:

        %%
        scope.TEST = function(a){
            if (a.val) {
                throw "stop"
            }    
        }
        %%
        O>C,BK;
        C>O,SP;
        TEST(ISLASTSP);
        

        Opening a trade, stopping after a trade.

    • Multi-cycle references

      The system automatically selects an appropriate underlying K-line cycle and synthesizes all referenced K-line data with this underlying K-line cycle data to ensure data accuracy.

      • Used for:#EXPORT 公式名 ... #ENDCreate a formula. If you don't do the formula calculation just to get the data for different cycles, you can also write the empty formula.

        The empty formula is:

        #EXPORT TEST 
        NOP;
        #END           // 结束
        
      • Used for:#IMPORT [MIN,周期,公式名] AS 变量值Reference formulae. Get data for the set cycle (closing price, opening price, etc., obtained by variable values).

        IMPORTIn commandMINWhat does that mean?MinutesThe inventors of the Ma language, a quantitative platform,IMPORTSupport only in commandMINLevels. Non-standard cycles are now supported, e.g.#IMPORT [MIN,240,TEST] AS VAR240Import data such as 240-minute cycles ((4 hours) K lines.

        Code example:

        // 本代码演示如何引用不同周期的公式在同一代码里
        // #EXPORT扩展语法,以#END结束标记为一个公式,可以声明多个
        #EXPORT TEST 
        均值1:EMA(C, 20);
        均值2:EMA(C, 10);
        #END // 结束
        
        #IMPORT [MIN,15,TEST] AS VAR15 // 引用公式,K线周期用15分钟
        #IMPORT [MIN,30,TEST] AS VAR30 // 引用公式,K线周期用30分钟
        CROSSUP(VAR15.均值1, VAR30.均值1),BPK;
        CROSSDOWN(VAR15.均值2, VAR30.均值2),SPK;
        十五分最高价:VAR15.HIGH;
        三十分最高价:VAR30.HIGH;
        AUTOFILTER;
        
      • Used for multi-cycle data referencingREFLLVHHVLet the instruction reference the data.

        (*backtest
        start: 2021-08-05 00:00:00
        end: 2021-08-05 00:15:00
        period: 1m
        basePeriod: 1m
        exchanges: [{"eid":"Futures_OKCoin","currency":"ETH_USD"}]
        args: [["TradeAmount",100,126961],["ContractType","swap",126961]]
        *)      
        
        %%
        scope.PRINTTIME = function() {
            var bars = scope.bars;
            return _D(bars[bars.length - 1].Time);
        }
        %%
        BARTIME:PRINTTIME;      
        
        #EXPORT TEST 
        REF1C:REF(C,1);
        REF1L:REF(L,1);
        #END // 结束      
        
        #IMPORT [MIN,5,TEST] AS MIN5
        INFO(1, 'C:', C, 'MIN5.REF1C:', MIN5.REF1C, 'REF(MIN5.C, 1):', REF(MIN5.C, 1), '触发BAR时间:', BARTIME, '#FF0000');
        INFO(1, 'L:', L, 'MIN5.REF1L:', MIN5.REF1L, 'REF(MIN5.L, 1):', REF(MIN5.L, 1), '触发BAR时间:', BARTIME, '#32CD32');
        AUTOFILTER;
        

        ComparisonMIN5.REF1CandREF(MIN5.C, 1)The difference can be seen in:MIN5.REF1Cis the closing price value of the second inverse of the closing price of the 5 minute K line data at the current time.REF(MIN5.C, 1)is the current model's K-line cycle (the above code retrieval cycle is set to 1 minute, i.e.period: 1mThe second BAR is the closing price of the 5-minute cycle. The two definitions are distinct and can be used as needed.

    • The pattern

      • A flat-line signal filtering model

        Write to the modelAUTOFILTERThe function controls and implements a one-to-one signal filtering, when multiple open signals meet the conditions, the first signal is taken as the valid signal, and the same signal on the following k-line is filtered out.

        Instructions that are supported by the filter model: BK, BP, BPK, SK, SP, SPK, CLOSEOUT, instructions that do not support bracketed instructions such as BK ((5)).

        For example:

        MA1:MA(CLOSE,5);
        MA2:MA(CLOSE,10);
        CROSSUP(C,MA1),BK;
        CROSSUP(MA1,MA2),BK;
        C>BKPRICE+10||C<BKPRICE-5,SP;
        AUTOFILTER;
        
        理解:
        如上范例,没有设置 AUTOFILTER 时,第三行BK 和第四行BK 第五行SP,依次触发,每根K线触发一次信号。开仓后,再到平仓,即重置模型状态。      
        如果设置 AUTOFILTER , 触发BK后,只能触发SP,其它的BK 信号被忽略,每根K线触发一次信号。
        
      • The model of increase and decrease

        Not written in the modelAUTOFILTERFunctions that allow continuous opening or closing signals can be raised or lowered.

        Supported instructions: BK ((N) BP ((N) SK ((N) SP ((N) CLOSEOUT BPK ((N) SPK ((N) ), which do not support open positions without a hand count. (1) Support for instruction grouping. (2) When multiple instruction conditions are simultaneously satisfied, the signal is executed in the order written in the condition statement. For example:

        MA1:MA(CLOSE,5);
        MA2:MA(CLOSE,10);
        CROSSUP(C,MA1),BK(1);
        CROSSUP(MA1,MA2),BK(1);
        C>BKPRICE+10||C<BKPRICE-5,SP(BKVOL);
        

        UseTRADE\_AGAINThe same command line can be used to send multiple signals in a row.

        理解:
        以上例子,逐个信号执行,执行后的信号不再触发。平仓后重置模型状态。一个K线触发一次信号。
        
      • A model of a K-line signal

        Whether or not the k-line is over, the signal is calculated and the order is placed in real time, i.e. the order is placed before the k-line is over; the order is reviewed at the end of the k-line, and the position is automatically synchronized if the holding direction does not match the signal direction at the end of the k-line.

        For example:

        MA1:MA(CLOSE,5);
        MA2:MA(CLOSE,10);
        CROSSUP(MA1,MA2),BPK;    // 5周期均线上穿10周期均线做多。
        CROSSDOWN(MA1,MA2),SPK;  // 5周期均线下穿10周期均线做空。
        AUTOFILTER;
        
      • A model of a K-line with multiple signals

        Model by usemultsigIt is used to control and implement multiple signals from a single K-line.

        Whether or not the k-line runs out, the signal is calculated and ordered in real time.

        The signal is not reviewed, there is no loss of signal, the signal direction is always consistent with the direction of holding.

        A K-line can be executed repeatedly if several signal conditions are met.

        例如:
        MA1:MA(CLOSE,5);
        MA2:MA(CLOSE,10);
        CROSSUP(MA1,MA2),BK;
        C>BKPRICE+10||C<BKPRICE-5,SP;
        AUTOFILTER;
        MULTSIG(0,0,2,0);
        

        MULTSIGIt is possible to execute different command lines multiple times in a single K line. A command line signal is sent only once.

        O<C,BK;            // 这些条件在一个K线Bar内,可能都执行,但是每行只出一次信号
        10+O<C,BK;         // 策略加上TRADE_AGAIN(10);可以使每行出多次信号
        20+O<C,BK;
        40+O<C,BK;
        MULTSIG(1,1,10);
        

        Added: In the plus/minus model, a k-line signal is supported in two ways: a closing price order, an order for an order for an order. 2, plus decomposition model, which also supports multiple signaling sequences of a k-line. The model of adding and subtracting stocks, writtenmultsigA function that implements a multiple addition or subtraction of a k-line.

    • Execution mode

      img

      • The closing model

        The closing price model refers to executing the model at the end of the current BAR and executing the transaction at the beginning of the lower root BAR.

      • Real-time pricing model

        Real-time price model refers to the execution of a model for each price change and the instantaneous trading of a signal. The real-time price model ignores the previous day's signals (the previous day's signals are executed immediately on the previous day), and the real-time price model only looks at the current market data to judge whether the signal is triggered.

    • The chart shows

      • Main additional indicators

        Use the operator^^, while assigning a variable, the setting indicator is shown on the main diagram.

        MA60^^MA(C, 60);  // 计算参数为60的均线指标
        

        img

      • Supplementary indicators

        Use the operator:, while assigning a variable, the setting indicator is shown in the subgraph.

        ATR:MA(MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW)),26);    // 给ATR变量赋值,":"符号后为计算ATR的公式
        

        img

        If you don't want it to show up on the main or sub-diagram, use the ... operator.

        MA60..MA(C, 60);  // 计算参数为60的均线指标
        

        img

        Can be usedDOTCOLORREDSet the type, color, etc. of the lines to suit the habits of users who are familiar with the Malay language.

    • Frequently asked questions

      Introduction to common problems encountered in the process of compiling indicatorsThe QuestionThis is a point that is usually taken into consideration when writing.

      • Pay attention to the score.;The end of the story.

      • Note that the system keyword cannot be used as a variable declaration.

      • Be careful with strings.Single quotation marksFor example:'开仓'This string.

      • Notes

        Notes

        • // 注释内容(English typing is allowed in the input method), representing code that is not compiled during execution, i.e. not executed//The following content, usually used to mark the meaning of the code, is easy to understand and remember when reviewing the code.

        • { 注释内容 }I'm not sure what to do.

          A:=MA(C,10);
          {上一行代码是计算均线。}
          
        • (* 注释内容 *)I'm not sure what to do.

          A:=MA(C,10);
          (*上一行代码是计算均线。*)
          
      • Input method

        When writing code, symbol errors are often caused by switching to English in the input method.:The end sign.;The comma.,The brackets.()In the same way, these different characters need to be taken into account in the Chinese-English state.

        If you are using the search dog, Baidu, Bing input method, you can do it by clicking on one of the buttons.shiftButton, quick switch from Chinese to English.

      • Logic is easy.

        1. At least, not less than, not less than: corresponding relational operator>=
        2. Maximum, maximum, not exceed: corresponding relational operators<=
      • Policy to start synchronization

        In a futures strategy, if a position is held manually before the strategy robot starts, the robot detects the position information when it starts, synchronizing it with the actual position status. It can be used in strategies.SPBPCLOSEOUTThe order is to stand still.

        %%
        if (!scope.init) {
            var ticker = exchange.GetTicker();
            exchange.Buy(ticker.Sell+10, 1);
            scope.init = true;
        }
        %%
        C>0, CLOSEOUT;
        
      • Do not support bidirectional holding

        The language does not support the same contract, but multiple empty holdings.

  • K-line data references

    • OPEN

      Get the opening price of the K-string chart.

      Opening price

      Function: OPEN, abbreviated O

      Parameters: none

      Explanation: Return to the opening price of "The Cycle"

      Sequence data

      OPEN取得K线图的开盘价。
      
      注:
      1、可简写为O。
      
      例1:
      OO:=O;           //定义OO为开盘价;注意O与0的区别。
      例2:
      NN:=BARSLAST(DATE<>REF(DATE,1));
      OO:=REF(O,NN);   //取的当日的开盘价
      例3:
      MA5:=MA(O,5);    //定义开盘价的5周期均线(O为OPEN简写)。
      
    • HIGH

      Get the highest price on the K-line chart.

      Highest price

      HIGH, abbreviated H

      Parameters: none

      Explanation: Returns the highest price of the "cycle"

      Sequence data

      HIGH取得K线图的最高价。
      
      注:
      1、可简写为H。
      
      例1:
      HH:=H;         // 定义HH为最高价
      例2:
      HH:=HHV(H,5);  // 取的5个周期内最高价的最大值
      例3:
      REF(H,1);      // 取的前一根K线的最高价
      
    • LOW

      Get the lowest price for the K-line chart.

      The lowest price

      Function: LOW, abbreviated as L

      Parameters: none

      Explanation: Returns the lowest price of "the cycle"

      Sequence data

      LOW取得K线图的最低价。
      
      注:
      1、可简写为L。
      
      例1:
      LL:=L;            // 定义LL为最低价
      例2:
      LL:=LLV(L,5);     // 取得5个周期内最低价的最小值
      例3:
      REF(L,1);         // 取得前一根K线的最低价
      
    • CLOSE

      Get the closing price of the K chart.

      The closing price

      Function: CLOSE, abbreviated as C

      Parameters: none

      Explanation: Return to the closing price of the cycle

      Sequence data

      CLOSE取得K线图的收盘价
      
      注:
      1、当盘中k线没有走完的时候,取得最新价。
      2、可简写为C。
      
      例1:
      A:=CLOSE;          //定义变量A为收盘价(盘中k线没有走完的时候A为最新价)
      例2:
      MA5:=MA(C,5);      //定义收盘价的5周期均线(C为CLOSE简写)
      例3:
      A:=REF(C,1);       //取得前一根k线的收盘价
      
    • VOL

      The transaction volume of the K-string graph is obtained.

      Amount of transaction

      Function: VOL, abbreviated V

      Parameters: none

      Explanation: Returns the transaction volume of the cycle

      Sequence data

      VOL取得K线图的成交量。
      
      注:
      可简写为V。
      该函数在当根TICK上的返回值为当天所有TICK成交量的累计值。
      
      例1:
      VV:=V;       // 定义VV为成交量
      例2:
      REF(V,1);    // 表示前一个周期的成交量
      例3:
      V>=REF(V,1); // 成交量大于前一个周期的成交量,表示成交量增加(V为VOL的简写)
      
    • OPI

      The total holdings of the current futures (contract) market.

      OpenInterest:OPI;
      
    • REF

      I'm going to go ahead and quote.

      引用X在N个周期前的值。
      
      注:
      1、当N为有效值,但当前的k线数不足N根,返回空值;
      2、N为0时返回当前X值;
      3、N为空值时返回空值。
      4、N可以为变量
      
      例1:
      REF(CLOSE,5);表示引用当前周期前第5个周期的收盘价
      例2:
      AA:=IFELSE(BARSBK>=1,REF(C,BARSBK),C);//取最近一次买开仓信号K线的收盘价
      // 1)发出BK信号的当根k线BARSBK返回空值,则发出BK信号的当根k线REF(C,BARSBK)返回
      空值;
      // 2)发出BK信号的当根k线BARSBK返回空值,不满足BARSBK>=1,则当根k线的收盘价。
      // 3)发出BK信号之后的k线BARSBK返回买开仓的K线距离当前K线的周期数,REF(C,BARSBK)
      返回开仓k线的收盘价。
      // 4)例:1、2、3 三根k线,1 K线为开仓信号的当根k线,则返回当根k线的收盘价,2、3
      K线返回 1 K线的收盘价。
      
    • UNIT

      The transaction unit that obtained the data contract.

      取数据合约的交易单位。
      用法:
      UNIT 取加载数据合约的交易单位。
      

      Cash in digital currency

      The UNIT value is 1⁄2.

      The future of digital currency

      The UNIT value is related to the contract currency.

      OKEX期货币本位合约:BTC合约1张代表100美元,其它币种的1张合约代表10美元
      
    • MINPRICE

      The minimum price change of the data contract.

      取数据合约的最小变动价位。
      用法:
      MINPRICE; 取加载数据合约的最小变动价位。
      
    • MINPRICE1

      The minimum price change of the transaction contract.

      取交易合约的最小变动价位。
      用法:
      MINPRICE1; 取交易合约的最小变动价位。
      
  • The time function

    • BARPOS

      Find the position of the K line.

      BARPOS,返回从第一根K线开始到当前的周期数。
      
      注:
      1、BARPOS返回本地已有的K线根数,从本机上存在的数据开始算起。
      2、本机已有的第一根K线上返回值为1。
      
      例1:LLV(L,BARPOS);        // 求本地已有数据的最小值。
      
      例2:IFELSE(BARPOS=1,H,0); // 当前K线是本机已有的第一根K线取最高值,否则取0。
      
    • DAYBARPOS

      DAYBARPOS if the root K line BAR is the tenth K line BAR of the day.

    • PERIOD

      The cycle value is the number of minutes.

      1, 3, 5, 15, 30, 60, 1440
      
    • DATE

      The dateThe DATE function returns the date of the year of the cycle from 1900 onwards.

      例1:
      AA..DATE;                  // 测试时AA的值为220218,表示2022年2月18日
      
    • TIME

      Take the time of the K line.

      TIME,取K线时间。
      
      注:
      1、该函数在盘中实时返回,在K线走完后返回K线的起始时间。
      2、该函数返回的是交易所数据接收时间,也就是交易所时间。
      3、TIME函数在秒周期使用时返回六位数的形式,即:HHMMSS,在其他周期上显示为四位数的形式,即:HHMM.
      4、TIME函数只能加载在日周期以下的周期中,在日周期及日周期以上的周期中该函数返回值始终为1500。
      5、使用TIME函数进行尾盘平仓的操作需要注意
      (1)尾盘平仓设置的时间建议设置为K线返回值中实际可以取到的时间(如:螺纹指数 5分钟周期 最后一根K线返回时间为1455,尾盘平仓设置为TIME>=1458,CLOSEOUT;则效果测试中不能出现尾盘平仓的信号)
      (2)使用TIME函数作为尾盘平仓的条件的,建议开仓条件也要做相应的时间限制(如设置尾盘平仓条件为TIME>=1458,CLOSEOUT;则相应的开仓条件中需要添加条件TIME<1458;避免平仓后再次开仓的情况)
      
      例1:
      C>O&&TIME<1450,BK;
      C<O&&TIME<1450,SK;
      TIME>=1450,SP;
      TIME>=1450,BP;
      AUTOFILTER;
      // 在14:50后平仓。
      例2:
      ISLASTSK=0&&C>O&&TIME>=0915,SK;
      
    • YEAR

      The year.

      YEAR,取得年份。
      
      注:
      YEAR的取值范围为1970—2033。
      
      例1:
      N:=BARSLAST(YEAR<>REF(YEAR,1))+1;
      HH:=REF(HHV(H,N),N);
      LL:=REF(LLV(L,N),N);
      OO:=REF(VALUEWHEN(N=1,O),N);
      CC:=REF(C,N);                               // 取上一年的最高价,最低价,开盘价,收盘价
      例2:
      NN:=IFELSE(YEAR>=2000 AND MONTH>=1,0,1);
      
    • MONTH

      The month is taken.

      MONTH,返回某个周期的月份。
      
      注:
      MONTH的取值范围为1—12.
      
      例1:
      VALUEWHEN(MONTH=3&&DAY=1,C);                // 在K线日期为三月一日时取其收盘价
      例2:
      C>=VALUEWHEN(MONTH<REF(MONTH,1),O),SP;
      
    • DAY

      Number of days in a cycle

      DAY,返回某一周期的日数。
      
      注:
      DAY取值范围为1-31。
      
      例1:
      DAY=3&&TIME=0915,BK;                      // 当日起为3日,时间为9点15分时,买开
      例2:
      N:=BARSLAST(DATE<>REF(DATE,1))+1;
      CC:=IFELSE(DAY=1,VALUEWHEN(N=1,O),0);      // 当日期为1时,取开盘价,否则取值为0
      
    • HOUR

      The hour.

      HOUR,返回某周期的小时数。
      
      注:
      HOUR的取值范围为0—23
      
      例1:
      HOUR=10;                                   // 在10:00的K线上返回值为1,其余K线上返回值为0
      
    • MINUTE

      I'm not going to lie.

      MINUTE,返回某个周期的分钟数。
      
      注:
      1:MINUTE的取值范围为0—59
      2:该函数只能加载在分钟周期上,返回当根K线开始的分钟数。
      例1:
      MINUTE=0;                                 // 在整点时刻的分钟K线上返回值为1,其余K线返回值为0
      例2:
      TIME>1400&&MINUTE=50,SP;                   // 在14:50的时候卖平仓
      
    • WEEKDAY

      The number of weeks is given here.

      WEEKDAY,取得星期数。
      
      注:
      1:WEEKDAY的取值范围是0—6。(星期日 ~ 星期六)
      
      例1:
      N:=BARSLAST(MONTH<>REF(MONTH,1))+1;
      COUNT(WEEKDAY=5,N)=3&&TIME>=1450,BP;
      COUNT(WEEKDAY=5,N)=3&&TIME>=1450,SP;
      AUTOFILTER;                               // 每个月交割日尾盘自动平仓
      例2:
      C>VALUEWHEN(WEEKDAY<REF(WEEKDAY,1),O)+10,BK;
      AUTOFILTER;
      
  • Logical judgment functions

    • BARSTATUS

      Returns the position state of the current cycle.

      BARSTATUS 返回当前周期的位置状态。
      
      注:
      该函数返回1表示当前周期是第一个周期,返回2表示是最后一个周期,返回0表示当前周期处于中间位置。
      
      例:
      A:=IFELSE(BARSTATUS=1,H,0);              // 如果当前K线是第一个周期,变量A返回K线最高值,否则取0
      
    • BETWEEN

      I'm not going to lie.

      BETWEEN(X,Y,Z) 表示X是否处于Y和Z之间,成立返回1(Yes),否则返回0(No)。
      
      注:
      1、其中若X=Y、X=Z、或X=Y且Y=Z时函数返回值为1(Yse)。
      
      例1:
      BETWEEN(CLOSE,MA5,MA10);                // 表示收盘价介于5日均线与10日均线之间
      
    • BARSLASTCOUNT

      BARSLASTCOUNT (COND) Calculates the number of cycles from the current cycle onwards, statistically counting the number of cycles that satisfy the condition continuously.

      注:
      1、返回值为从当前周期计算COND连续不为0的周期数
      2、条件第一次成立的当根k线上BARSLASTCOUNT(COND)的返回值为1
      
      例:
      BARSLASTCOUNT(CLOSE>OPEN);
      //计算当根K线在内连续为阳线的周期数
      
    • CROSS

      Cross functions are also called cross functions.

      CROSS(A,B) 表示A从下方向上穿过B,成立返回1(Yes),否则返回0(No)
      
      注:
      1、满足穿越的条件必须上根k线满足A<=B,当根k线满足A>B才被认定为穿越。
      
      例1:
      CROSS(CLOSE,MA(CLOSE,5));              // 表示收盘线从下方向上穿过5周期均线
      
    • CROSSDOWN

      Going down.

      CROSSDOWN(A,B):表示当A从上方向下穿B,成立返回1(Yes),否则返回0(No)
      
      注:
      1、CROSSDOWN(A,B)等同于CROSS(B,A),CROSSDOWN(A,B)编写更利于理解
      
      例1:
      MA5:=MA(C,5);
      MA10:=MA(C,10);
      CROSSDOWN(MA5,MA10),SK;               // MA5下穿MA10卖开仓
      // CROSSDOWN(MA5,MA10),SK;与CROSSDOWN(MA5,MA10)=1,SK;表达同等意义
      
    • CROSSUP

      I'm going to cross over.

      CROSSUP(A,B)表当A从下方向上穿过B,成立返回1(Yes),否则返回0(No)
      
      注:
      1、CROSSUP(A,B)等同于CROSS(A,B),CROSSUP(A,B)编写更利于理解。
      
      例1:
      MA5:=MA(C,5);
      MA10:=MA(C,10);
      CROSSUP(MA5,MA10),BK;                 // MA5上穿MA10,买开仓
      // CROSSUP(MA5,MA10),BK;与CROSSUP(MA5,MA10)=1,BK;表达同等意义
      
    • EVERY

      It's not just about what you're going to do.

      EVERY(COND,N),判断N周期内是否一直满足COND条件。若满足函数返回值为1,不满足函数返回值为0。
      
      注:
      1、N包含当前k线。
      2、若N是有效数值,但前面没有那么多K线,或者N为空值,代表条件不满足,函数返回值为0。
      3、N可以是变量。
      
      例1:
      EVERY(CLOSE>OPEN,5);                // 表示5个周期内一直是阳线
      例2:
      MA5:=MA(C,5);                       // 定义5周期均线
      MA10:=MA(C,10);                     // 定义10周期均线
      EVERY(MA5>MA10,4),BK;               // 4个周期内MA5都大于MA10,则买开仓
      // EVERY(MA5>MA10,4),BK;与EVERY(MA5>MA10,4)=1,BK;表达同等意义
      
    • EXIST

      Judging whether there is satisfaction.

      EXIST(COND,N)判断N个周期内是否有满足COND的条件。
      
      注:
      1、N包含当前k线。
      2、N可以是变量。
      3、若N是有效数值,但前面没有那么多K线,按实际周期数计算。
      
      例1:
      EXIST(CLOSE>REF(HIGH,1),10);     // 表示10个周期中是否存在收盘价大于前一个周期的最高价,存在返回1,不存在则返回0
      例2:
      N:=BARSLAST(DATE<>REF(DATE,1))+1;
      EXIST(C>MA(C,5),N);              // 表示当天是否有满足收盘价大于5周期均线的k线,存在返回1,不存在返回0
      
    • IF

      The conditional function.

      IF(COND,A,B)若COND条件成立,则返回A,否则返回B。
      
      注:
      1、COND是判断条件;A、B可以是条件,也可以是数值。
      2、该函数支持变量循环引用前一周期自身变量,即支持下面这样的写法Y:IF(CON,X,REF(Y,1))。
      例1:
      IF(ISUP,H,L);                   // k线为阳线,取最高价,否则取最低价
      例2:
      A:=IF(MA5>MA10,CROSS(DIFF,DEA),IF(CROSS(D,K),2,0));     // 当MA5>MA10时,取是否满足DIFF上穿DEA,否则(MA5不大于MA10),当K,D死叉时,令A赋值为2,若上述条件都不满足,A赋值为0
      A=1,BPK;                                                // 当MA5>MA10,以DIFF上穿DEA作为开多仓条件
      A=2,SPK;                                                // 当MA5不大于MA10,以K、D死叉作为开空仓条件
      
    • IFELSE

      The conditional function.

      IFELSE(COND,A,B) 若COND条件成立,则返回A,否则返回B。
      
      注:
      1、COND是判断条件;A、B可以是条件,也可以是数值。
      2、该函数支持变量循环引用前一周期自身变量,即支持下面这样的写法Y: IFELSE(CON,X,REF(Y,1));
      例1:
      IFELSE(ISUP,H,L);                                             // k线为阳线,取最高价,否则取最低价
      例2:
      A:=IFELSE(MA5>MA10,CROSS(DIFF,DEA),IFELSE(CROSS(D,K),2,0));   // 当MA5>MA10时,取是否满足DIFF上穿DEA,否则(MA5不大于MA10),当K,D死叉时,令A赋值为2,若上述条件都不满足,A赋值为0
      A=1,BPK;                                                      // 当MA5>MA10,以DIFF上穿DEA作为开多仓条件
      A=2,SPK;                                                      // 当MA5不大于MA10,以K、D死叉作为开空仓条件
      
    • ISCONTRACT

      Whether the contract is currently in force or not.

      ISCONTRACT(CODE)当前是否为指定的合约。
      
      用法:ISCONTRACT(CODE);是当前合约返回1,不是当前合约返回0。
      
      注:
      1、判断是否为指定合约时,CODE可以为合约的交易代码。
      
      例:
      ISCONTRACT('this_week');    // 数字货币OKEX期货合约
      ISCONTRACT('XBTUSD');       // 数字货币BITMEX期货合约
      

      Support for regular expressions.

      Judging the Contract

      ISCONTRACT('this_week');                     // 判断当前合约是否为OKEX期货 this_week(当周)合约
      

      Determine the name of the exchange

      ISCONTRACT('@Futures_(Binance|FTX)');       // 判断当前交易所对象是否为Binance期货或者FTX期货
      ISCONTRACT('@(OKEX|Bitfinex)');             // 判断交易所,需要在开头加@字符
      
    • ISDOWN

      I'm not going to tell you about it.

      ISDOWN判断该周期是否收阴。
      
      注:
      1、ISDOWN等同于C<O
      
      例:
      ISDOWN=1&&C<REF(C,1),SK;                    // 当根k线收阴并且收盘价小于前一周期收盘价,则开空
      // ISDOWN=1&&C<REF(C,1),SK;与ISDOWN&&C<REF(C,1),SK; 表达同等意义
      
    • ISEQUAL

      Flat plate.

      ISEQUAL判断该周期是否平盘。
      
      注:
      1、ISEQUAL等同于C=O
      
      例1:
      EVERY(ISEQUAL=1,2),CLOSEOUT;                // 持续2根k线都是平盘,则全平
      
    • ISLASTBAR

      Determine if the cycle is the last K-line.

      ISLASTBAR判断该周期是否为最后一根k线。
      
      例1:
      VALUEWHEN(ISLASTBAR=1,REF(H,1));            // 当前k线是最后一根k线,则取前一周期的最高价
      
    • ISNULL

      Judge the empty value.

      ISNULL判断空值。
      
      用法:ISNULL(N);如果N为空值,函数返回1;如果N为非空值,函数返回0。
      
      例:MA5:=IFELSE(ISNULL(MA(C,5))=1,C,MA(C,5));   // 定义五周期均线,K线数量不足五根时,返回当根K线的收盘价
      
    • ISUP

      The sunshine.

      ISUP判断该周期是否收阳。
      
      注:
      1、ISUP等同于C>O。
      
      例:
      ISUP=1&&C>REF(C,1),BK;   // 若当根k线收阳并且收盘价大于前一周期收盘价,则开多
                               // ISUP=1&&C>REF(C,1),BK; 与 ISUP&&C>REF(C,1),BK
                               // 表达同等意义
      
    • LAST

      Judge the function.

      LAST(COND,N1,N2)判断过去N1到N2周期内,是否一直满足COND条件。
      
      注:
      1、若N1与N2只相差一个周期(如N1=3,N2=2),则函数判断距离当前K线最近的那个周期上是否满足条件(即判断过去N2个周期的那根K线上是否满足条件)。
      2、当N1/N2为有效值,但当前的k线数不足N1/N2根,或者N1/N2空值的情况下,代表不成立,该函数返回0。
      3、N1、N2不可以是变量。
      
      例1:
      LAST(CLOSE>OPEN,10,5);   // 表示从过去第10个周期到第5个周期内一直是阳线
      例2:
      MA5:=MA(C,5);
      LAST(C>MA5,4,3);         // 判断距离当前k线3个周期的那根k线上是否满足C大于MA5
      
    • LONGCROSS

      Maintain the cross function.

      LONGCROSS(A,B,N)表示A在N个周期内都小于B,本周期A从下向上穿越B。
      
      注:
      1、当N为有效值,但当前的k线数不足N根时,LONGCROSS函数返回空值。
      2、N不支持变量。
      
      例1:
      LONGCROSS(CLOSE,MA(CLOSE,10),20);   // 表示收盘线在10日均线之下持续20周期后从下向上穿过10日均线
      
    • NOT

      Not so...

      NOT(X):取非。当X=0时返回1,否则返回0。
      例1:
      NOT(ISLASTBK);如果上一个信号不是BK信号,则NOT(ISLASTBK)返回值为1;上一个信号是BK信号,则NOT(ISLASTBK)返回值为0。
      例2:
      NOT(BARSBK>=1)=1;                  // BK信号发出的当根K线上满足条件
      // NOT(BARSBK>=1)=1与NOT(BARSBK>=1)表达同等意义
      
    • NULL

      Returns the empty value.

      返回空值
      用法:
      MA5:=MA(C,5);
      MA10:=MA(C,10);
      A:=IFELSE(MA5>MA10,MA5,NULL),COLORRED;  // 当MA5>MA10时,画五日均线MA5,不满足MA5>MA10时,返回空值,不画线
      
    • VALUEWHEN

      The value is taken.

      VALUEWHEN(COND,X)当COND条件成立时,取X的当前值。如COND条件不成立,则取上一次COND条件成立时X的值。
      
      注:
      X可以是数值也可以是条件。
      
      例1
      VALUEWHEN(HIGH>REF(HHV(HIGH,5),1),HIGH);  // 表示当前最高价大于前五个周期最高价的最大值时返回当前最高价
      例2:
      VALUEWHEN(DATE<>REF(DATE,1),O);           // 表示取当天第一根k线的开盘价(即当天开盘价)
      例3:
      VALUEWHEN(DATE<>REF(DATE,1),L>REF(H,1));  // 表示在当天第一根k线上判断当前最低价是否大于昨天最后一根K线的最高价。返回1,说明当天跳空高开。返回0,说明当天不满足跳空高开条件
      
  • Looped execution function

    • LOOP2

      The loop condition function.

      LOOP2(COND,A,B);循环条件函数若COND条件成立,则返回A,否则返回B。
      
      注:
      1、COND是判断条件;A、B可以是条件,也可以是数值。
      2、该函数支持变量循环引用前一周期自身变量,即支持下面这样的写法Y:=LOOP2(CON,X,REF(Y,1));
      
      例1:
      X:=LOOP2(ISUP,H,REF(X,1));                // k线为阳线,取当根K线的最高价,否则取上一次是阳线的K线的最高价;若之前未出现过阳线时,X返回为空值
      
      例2:
      BB:=LOOP2(BARSBK=1,LOOP2(L>LV(L,4),L,LV(L,4)),LOOP2(L>REF(BB,1),L,REF(BB,1))); // 持有多单时,开多单那根的前面4个周期内的最低价为起始止损点BB,后续K线最低价比前一个最低价高,取当前最低价为止损点,否则取前一个低点为止损点
      SS:=LOOP2(BARSSK=1,LOOP2(H<HV(H,4),H,HV(H,4)),LOOP2(H<REF(SS,1),H,REF(SS,1))); // 持有空单时,开空单那根的前面4个周期内的最高价为起始止损点SS,最高价比前一个最高价低,取当前最高价为止损点,否则取前一个高点为止损点
      H>HV(H,20),BK;
      L<LV(L,20),SK;
      C<BB,SP;
      C>SS,BP;
      AUTOFILTER;
      
  • Financial statistical functions

    • BARSCOUNT

      The first valid cycle to the current cycle number.

      BARSCOUNT(COND)第一个有效周期到当前的周期数。
      
      注:
      1、返回值为COND从第一个有效周期开始计算,到现在为止的周期数。
      2、条件第一次成立的当根k线上BARSCOUNT(COND)的返回值为0。
      
      例:
      BARSCOUNT(MA(C,4));                       // 计算MA(C,4)第一次有返回值到当前的周期数
      
    • BARSLAST

      The last time the condition was set up.

      BARSLAST(COND),上一次条件COND成立到当前的周期数。
      
      注:
      1、条件成立的当根k线上BARSLAST(COND)的返回值为0。
      
      例1:
      BARSLAST(OPEN>CLOSE);                     // 上一根阴线到现在的周期数
      例2:
      N:=BARSLAST(DATE<>REF(DATE,1))+1;         // 分钟周期,当日k线数
      // 由于条件成立的当根k线上BARSLAST(COND)的返回值为0,所以“+1”才是当日k线根数
      

      ExplainedBARSLASTThe function:

      • 1 {\displaystyle 1} returns 0 {\displaystyle 0} if the current K line condition is satisfied.
      • 2, if not formed, will continue to go backwards until it finds the line K on which the condition is formed, returning a backward periodic number.
      • 3, returns a null value if no K-string is found at the end of which the condition was created.
    • BARSSINCE

      The first condition is set to the current number of cycles.

      BARSSINCE(COND)第一个条件成立到当前的周期数。
      
      注:
      1、返回值为COND第一次成立到当前的周期数。
      2、条件第一次成立的当根k线上BARSSINCE(COND)的返回值为0。
      
      例:
      BARSSINCE(CLOSE>OPEN);                    // 统计第一次满足阳线这个条件的K线到现在的周期数
      
    • BARSSINCEN

      The first condition in the statistical cycle N is established to the current number of cycles.

      BARSSINCEN(COND,N)统计N周期内第一次条件成立到当前的周期数。
      
      注:
      1、N包含当前k线。
      2、当N为有效值,但当前的k线数不足N根,按照实际的根数计算。
      3、若N为0返回无效值。
      4、N可以为变量。
      
      例:
      N:=BARSLAST(DATE<>REF(DATE,1))+1;        // 分钟周期,当日K线数
      BARSSINCEN(ISUP,N);                      // 统计N周期内第一次满足阳线到当前的周期数
      
    • CONDBARS

      Find the number of interlinear K cycles that most recently satisfy the conditions A and B.

      CONDBARS(A,B);取得最近的满足A、B条件的k线间周期数。
      
      注意:
      1、该函数返回周期数不包含最后满足条件的K线。
      2、距离当前K线最近的满足的条件为B条件,则该函数返回值为最后一次满足A条件的K线到满足B条件的K线的周期数(A条件满足后的第一次满足B条件的K线)。
      距离当前K线最近的满足的条件为A条件,则该函数返回值为最后一次满足B条件的K线到满足A条件的K线的周期数(B条件满足后的第一次满足A条件的K线)。
      
      例1:
      MA5:=MA(C,5);                                        // 5周期均线
      MA10:=MA(C,10);                                      // 10周期均线
      CONDBARS(CROSSUP(MA5,MA10),CROSSDOWN(MA5,MA10));     // 最近一次满足5周期均线上穿10周期均线与5周期均线下穿10周期均线之间的周期数
      
    • COUNT

      The statistics are as follows:

      COUNT(COND,N),统计N周期中满足COND条件的周期数。
      
      注:
      1、N包含当前k线。
      2、若N为0则从第一个有效值算起。
      3、当N为有效值,但当前的k线数不足N根,从第一根统计

More

98K-series high-end trading indicatorsIf you have a k-line that passes through j1 and the sun line stops at j1, then you have to press j1 again to open it, but when you can retrieve it, it's in the x-line and it's not at j1. D1: = if (jk < 0 && CROSS ((close,j1) and CLOSE> OPEN and close>j1,j1,0); D1, BK; /upload/asset/2af6fee 82ea8bb3725687.png This is a list of all the different ways D1, BK is credited in the database.

98K-series high-end trading indicatorsIn the domestic love trading platform there is a library of functions in Maicon language, it is not known if it will be compatible in the future, like the functions on the compatible tradingview, such a two-sided indicator strategy, can be directly transferred to the inventor and quantified.

98K-series high-end trading indicatorsisLast ((x)) Function description: Determine if the current data is the last data. Is this function function on the inventor?

wanghehe711@qq.comIs it possible to have a multilingual operating system for Mac?

ltcremCan you give an example if you want to embed a MARK key in Java or Python?

The cloudsDoes Ma support the OKEX contract? Can you access the OKEX contract API?

The Little DreamWell, look at this.

The Little DreamCurrently, this isLast instruction is not supported

The Little DreamThe Mac language is a single-variety single-platform strategy that can only handle one variety, one account.

The Little DreamThis is a more complex design, and it is recommended to write the policy directly using JS, PY if it is a listing policy.

The Little DreamSupport is available for OKEX contracts.