MyLanguage Doc

저자:작은 꿈, 창작: 2022-06-30 18:24:06, 업데이트: 2024-02-06 17:36:19

[TOC]

img

MyLanguage는 MyLanguage와 호환되고 향상된 프로그래밍 트레이딩 언어입니다. FMZ Quant의 MyLanguage는 엄격한 문법 검사를 받게됩니다. 예를 들어 JavaScript 언어 코드를 임베드하기 위해 언어 향상을 사용할 때, 추가 공간 문자가%%오퍼레이터가 오류를 보고하도록 합니다.

  • 기본 지침

    • 계약

      암호화폐 계약

      암호화폐 계약

      this_week     cryptocurrency futures contract this week
      next_week     cryptocurrency futures contract next week
      month         cryptocurrency futures contract month
      quarter       cryptocurrency futures contract quarter
      next_quarter  cryptocurrency futures contract next quarter
      third_quarter cryptocurrency futures contract third quarter
      last_quarter  contract last quarter
      
      XBTUSD        BITMEX perpetual contract
      swap          cryptocurrency futures perpetual contracts other than BITMEX exchange
      
      For details, please refer to the exchange.SetContractType() function section of the JavaScript/Python/C++ documentation
      

      img

    • 변수

      변수는 데이터를 저장하기 위해 컴퓨터 메모리에서 열린 공간이다. 간단히 말해서, 데이터를 저장하는 데 사용됩니다.

      첫 번째 변수를 열어

      // assign 1 to variable a
      a:=1;
      

      들어와MyLanguage, 그것은 쉽게 구별 할 수 있습니다data volume:

      1. 단일 값 데이터: 하나의 값만 있습니다.0, 1, 'abc'.
      2. 연속 데이터: 단일 값의 데이터 그룹으로 구성된 일련의 데이터, 예를 들어Close(폐기 가격)Close마감값을 포함합니다.n periods. [ 10.1 , 10.2 , 10.3 , 10.4 , 10.5 ...]

      변수 타입과 구별

      1. 문자열 유형: 그것은 ```로 싸워야 합니다. 문자열 유형은 직접 사용할 수 없습니다. 그리고 그것은 함수와 함께 보기로 출력되어야 합니다.
      INFO(CLSOE>OPEN,'OK!');
      
      1. 값 유형: 정수, 부동 소수점 숫자 (제곱 소수) 를 포함합니다.
      // integer
      int:=2;
      
      // decimal
      float:=3.1;
      
      1. 부엘 타입, 1 (진정한 경우) 또는 0 (거짓말 경우): 1, 0, true 또는 false. 예를 들어:A:=1>0;이 코드가 실행된 후,A1입니다.
      // The closing price of the current period is greater than -999, you will find that the return value of each period is 1, which means true, because the closing price is almost impossible to be negative.
      is_true:=Close>-999;
      
      1. 글로벌 변수
      VARIABLE:VALUE1:10;     // Declare a global variable, assign the value 10, and execute it only once.
      

      백테스팅을 할 때 주목하세요.

      VARIABLE:NX:0;    // The initial global variable NX is 0
      NX..NX+1;         // Accumulate 1 each time
      INFO(1,NX);       // Print NX every time
      

      초기에는INFO진술 인쇄물101어쩌면 그렇지 않을지도 몰라0처음엔? 그 이유는 백테스트에서 100개의 초기 K-라인들이 있고, 100개의 K-라인들이 이미 실행되었기 때문에, 100번의 누적입니다. 실제 가격은 처음에 얼마나 많은 K 라인을 얻느냐에 달려 있습니다.

      • 명칭 규정

        대부분의 시스템에서 변수 명칭은 시스템 보유 단어 (내장 변수 이름, 함수 이름) 의 사용을 허용하지 않습니다. 예를 들어, 잘 알려진Close, C또한 순수 또는 선수 숫자는 허용되지 않습니다. 마지막으로, 그것은 매우 길게 허용되지 않습니다. 다른 시스템에는 다른 길이 제한이 있습니다. 사실, 당신은 중국어 분석의 주류 시스템의 효율성에 대해 걱정할 필요가 없습니다. 나는 MyLanguage가 중국어에 매우 친화적이라고 믿습니다. 경험이 많은 프로그래머는 다음 두 가지 명칭 규칙을 사용하는 것이 좋습니다.

        1. 중국어 이름
        // elegant output
        5-day moving average:=MA(C,5);
        
        1. 영어 + 밑줄
        // Output
        move_avg_5:=MA(C,5);
        

        만약 당신이 영어를 선호한다면, 가능한 한 변수의 의미를 이해하도록 노력하십시오.A1, AAA, BBB...신뢰하세요, 몇 일 후에 다시 표시 코드를 검토할 때, 기억 상실으로 인해 매우 불행해질 것입니다. 마찬가지로, 다른 사람에게 코드를 수출할 때, 독자는 파괴 될 것입니다.

        이제부터 MyLanguage을 최대한 활용하세요! 분석과 의사결정에 강력한 도구가 되길 바랍니다.

    • 데이터 유형

      데이터의 유형은 기본적인 개념입니다. 우리가 명확한 데이터를 변수에 서면으로 할당하면 변수는 또한 데이터의 유형이 됩니다.

        1. 값의 종류:
        1.2.3.1.1234.2.23456 ...
        
        1. 문자열 타입:
        '1' .'2' .'3' ,String types must be wrapped with ''
        
        1. 순서 데이터:
        A collection of data consisting of a series of single-valued data
        
        1. 형 (형):

        사용1나타냅니다.true그리고0에 대해false.

        예제

        // declare a variable of value type
        var_int := 1;
        // Declare a variable for sequence data
        var_arr := Close;
        // The string type cannot be declared alone, it needs to be combined with the function
        INFO(C>O, 'positive line');
        
    • 운영자

      지표 코드를 실행하는 데 사용되는 동작과 계산은 단순히 동작에 관련된 기호입니다.

      • 할당 운영자

        변수에 값을 부여하기 위해

          1. :

          :, 그래프에 할당 및 출력을 나타냅니다.

          Close1:Close;      // Assign Close to the variable Close1 and output to the figure
          
          1. :=

          :=, 할당을 나타내지만 그래프에 출력되지 않습니다 (주 그래프, 하위 그래프...), 상태 바 테이블에도 표시되지 않습니다.

          Close2:=Close;     // Assign Close to the variable Close2
          
          1. ^^

          ^^2^기호는 할당을 나타내고, 변수에 값을 할당하고 그래프에 출력합니다 (주 그래프).

          lastPrice^^C;
          
          1. ..

          .., 2.기호는 할당을 나타내고 변수에 값을 부여하고 차트에 변수 이름과 값을 표시하지만 차트에 그림을 그리지 않습니다 (주면, 하위 그림...).

          openPrice..O
          
      • 관계 연산자

        관계 연산자는 두 데이터 사이의 관계를 결정하기 위해 조건 표현식에서 사용되는 이진 연산자입니다.

        반환 값: 부올형, 또는true(1) 또는false(0).

          1. 더 많은>
          // Assign the operation result of 2>1 to the rv1 variable, at this time rv1=1
          rv1:=2>1;
          
          1. 이보다 작다<
          // Returns false, which is 0, because 2 is greater than 1
          rv3:=2<1;
          
          1. 이보다 크거나 같거나>=
          x:=Close;
          // Assign the result of the operation that the closing price is more than or equal to 10 to the variable rv2
          // Remark that since close is a sequence of data, when close>=10 is performed, the operation is performed in each period, so each period will have a return value of 1 and 0
          rv2:=Close>=10;
          
          1. 더 작거나 같거나<=
          omitted here
          
          1. 같다는 것=
          A:=O=C;     // Determine whether the opening price is equal to the closing price.
          
          1. 이 값은<>
          1<>2       // To determine whether 1 is not equal to 2, the return value is 1 (true)
          
      • 논리 연산자

        반환 값: 부올형, 또는true(1) 또는false(0).

        1. 논리적이고&&, 로 대체 될 수 있습니다.and, 그리고 좌측과 우측의 연결은 동시에 설정되어야합니다.
        // Determine whether cond_a, cond_b, cond_c are established at the same time
        cond_a:=2>1;
        cond_b:=4>3;
        cond_c:=6>5;
        cond_a && cond_b and cond_c;    // The return value is 1, established
        
        1. 논리적 또는||, 당신은 사용할 수 있습니다oror 링크의 왼쪽과 오른쪽을 대체하려면 한쪽이 true (진짜), 전체가 true (진짜) 입니다.
        cond_a:=1>2;
        cond_b:=4>3;
        cond_c:=5>6;
        cond_a || cond_b or cond_c;    // The return value is 1, established
        
        1. ()오퍼레이터, 괄호에 있는 표현식은 먼저 평가됩니다.
        1>2 AND (2>3 OR 3<5)    // The result of the operation is false
        1>2 AND 2>3 OR 3<5      // The result of the operation is true
        
      • 수학적 연산자

        Return value: numeric type
        

        수학적 연산자는 수학적 연산자이다. 기본 수학적 연산 (수학적 연산자) 를 완료하는 기호이며, 이는 네 가지 수학적 연산을 처리하는 기호이다.

        • 더하기 +

          A:=1+1;      // return 2
          
        • -

          A:=2-1;      // return 1
          
        • *곱하기 *

          A:=2*2;      // return 4
          
        • 나누기

          A:=4/2;      // return 2
          
    • 기능

      • 기능

        프로그래밍 세계에서 함수은 특정 함수를 구현하는 코드 조각입니다. 다른 코드로 호출 될 수 있습니다. 일반적인 형태는 다음과 같습니다.

        function(param1,param2,...)
        
        • 성분:

          함수 이름 (parameter1, parameter2,...), 변수가 없거나 여러 변수가 있을 수 있습니다. 예를 들어,MA(x,n);가동평균으로 돌아가는 것을 의미합니다.x내부n그 중에서도MA()함수입니다.x그리고n함수의 매개 변수입니다.

          함수를 사용할 때, 함수의 기본 정의, 즉 함수를 호출하여 어떤 데이터를 얻을 수 있는지 이해해야합니다. 일반적으로 함수에는 매개 변수가 있습니다. 매개 변수를 전달할 때, 입력되는 데이터 유형이 일관성 있는지 확인해야합니다. 이 단계에서 대부분의 IDE의 코드 힌트 함수는 매우 불완전합니다. 주어진 매개 변수의 데이터 유형이 있습니다. 이것은 우리의 사용에 약간의 어려움을 가져옵니다.MA(x,n);다음과 같이 해석됩니다.

          Return to simple moving average
          Usage:
          AVG:=MA(X,N): N-day simple moving average of X, algorithm (X1+X2+X3+...+Xn)/N, N supports variables
          

          이것은 초보자에게는 매우 불친화적이지만, 다음으로, 우리는 함수를 철저히 해독하고, 함수를 배우고 사용하는 빠른 방법을 찾으려고 합니다.

      • 반환 값

        함수를 빨리 배우기 위해서는 먼저 개념을 이해해야 합니다.반환, 이름에서 알 수 있듯이, 귀향을 뜻합니다. 값은 특정값을 나타냅니다. 그러면 반환값의 의미는: 얻을 수 있는 데이터입니다.

        // Because it will be used in the following code, the variable return_value is used to receive and save the return value of function()
        // retrun_value := function(param1,param2);
        // For example:
        AVG:=MA(C,10);     // AVG is retrun_value, function is MA function, param1 parameter: C is the closing price sequence data, param2 parameter: 10.
        
      • 매개 변수

        둘째, 함수의 두 번째 중요한 개념은 매개 변수이며, 다른 매개 변수를 전달함으로써 다른 반환 값을 얻을 수 있습니다.

        // The variable ma5 receives the 5-day moving average of closing prices
        ma5:=MA(C,5);
        // The variable ma10 receives the 10-day moving average of closing prices
        ma10:=MA(C,10);
        

        첫 번째 매개 변수X위의 변수들ma5, ma10C(폐기 가격) 사실,C또한 함수입니다 (개점부터 현재까지의 폐쇄 가격의 순서를 반환합니다), 그러나 매개 변수가 없습니다. 두 번째 매개 변수의 5 및 10은 매개 변수를 알려줍니다.MA()이 함수는 매개 변수를 통해 보다 유연하게 사용할 수 있습니다.

      • 학습 방법

          1. 먼저, 함수가 무엇을 하는지, 즉 이 함수가 우리에게 어떤 데이터를 반환할 수 있는지 이해해야 합니다.
          1. 마지막으로 반환값의 유형을 이해해야 합니다. 결국, 우리는 반환값을 얻기 위해 함수를 사용합니다.
          1. 또한, 우리는 매개 변수의 데이터 타입을 알아야 합니다MA(x,n), 만약 매개 변수의 데이터 타입을 모른다면x, n, 그것은 반환 값을 올바르게 얻을 수 없습니다.

        다음 기능 도입 및 사용에서 위의 세 가지 원칙을 따르십시오.

    • 언어 향상

      • MyLanguage그리고JavaScript언어 혼합 프로그래밍

        %%
        // This can call any API quantified of FMZ
        scope.TEST = function(obj) {
            return obj.val * 100;
        }
        %%
        Closing price: C;
        Closing price magnified 100 times: TEST(C);
        The last closing price is magnified by 100 times: TEST(REF(C, 1)); // When the mouse moves to the K-line of the backtest, the variable value will be prompted
        
        • scope물체

          scopeobject는 속성을 추가하고 속성에 익명 함수를 할당할 수 있고, 이 속성이 참조하는 익명 함수는 MyLanguage의 코드 부분에서 호출될 수 있습니다.

        • scope.getRefs(obj)기능

          들어와JavaScript코드 블록, 전화scope.getRefs(obj)입력된 데이터를 반환하는 기능obj object.

          JavaScript다음의 코드로 포장된 코드%% %%받을 것입니다.C그 때 통과TEST(C)MyLanguage 코드에서 함수는 Close price라고 합니다. 의scope.getRefs이 K-라인 데이터의 모든 폐쇄 가격을 반환합니다.throw "stop"프로그램을 중단하려면 변수arr첫 번째 바의 폐쇄 가격을 포함합니다. 당신은 삭제하려고 할 수 있습니다throw "stop", 그것은 실행return그 끝에서JavaScript코드, 그리고 모든 폐쇄 가격 데이터를 반환합니다.

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

          모든 K-라인 바에 액세스JavaScript코드 블록.

          TEST함수는 값을 반환합니다. 1은 음직이고 0은 양직입니다.

          %%
          scope.TEST = function(){
              var bars = scope.bars
              return bars[bars.length - 1].Open > bars[bars.length - 1].Close ? 1 : 0    // Only numeric values can be returned
          }
          %%
          arr:TEST;                                                                      
          
          # Attention:
          # An anonymous function received by TEST, the return value must be a numeric value.
          # If the anonymous function has no parameters, it will result in an error when calling TEST, writing VAR:=TEST; and writing VAR:=TEST(); directly.
          # TEST in scope.TEST must be uppercase.
          
        • scope.bar

          이 지역에서는JavaScript코드 블록, 현재 바에 접근합니다.

          높은 오픈 가격과 낮은 종료 가격의 평균을 계산합니다.

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

          시장 깊이 데이터 접근 (오더 포크)

          %%
          scope.TEST = function(){
              Log(scope.depth)
              throw "stop"             // After printing the depth data once, throw an exception and pause
          }
          %%
          TEST;
          
        • scope.symbol

          현재 거래 쌍의 이름 문자열을 얻으십시오.

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

          K-라인의 바 위치를 잡아요.

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

          이 함수는 MyLanguage의 코드 섹션의 변수를 얻기 위해 사용됩니다.

          V:10;
          %%
          scope.TEST = function(obj){
              return scope.get_locals('V')
          }
          %%
          GET_V:TEST(C);
          
          # Attention:
          # If a variable cannot calculate the data due to insufficient periods, call the scope.get_locals function in the JavaScript code at this time
          # When getting this variable, an error will be reported: line:XX - undefined locals A variable name is undefined
          
        • scope.canTrade

          canTrade현재 바가 거래될 수 있는지 (현재 바가 마지막인지)

          예를 들어, 시장 데이터가 전략이 거래될 수 있는 상태에서 인쇄된다고 판단하면

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

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

        한 번 포지션을 열고 닫은 후에 전략을 중지하십시오.

    • 여러 기간 참조

      시스템은 적절한 기본 K-라인 기간을 자동으로 선택하고, 이러한 기본 K-라인 기간 데이터를 사용하여 데이터의 정확성을 보장하기 위해 참조된 모든 K-라인 데이터를 합성합니다.

      • 사용 방법:#EXPORT formula_name ... #END수식을 만들 수 있습니다. 수식이 다른 기간의 데이터를 얻기 위해 계산되지 않는다면, 빈 수식을 쓸 수도 있습니다.

        빈 공식은

        #EXPORT TEST 
        NOP;
        #END           // end
        
      • 사용 방법:#IMPORT [MIN,period,formula name] AS variable value정해진 기간의 다양한 데이터를 얻으십시오 (변수 값으로 얻은 종료 가격, 시작 가격 등).

        MINIMPORT명령어 의미분자 수준FMZ 퀀트 플랫폼의 MyLanguage,MIN이 수준은IMPORT명령어. 비표준 기간은 이제 지원됩니다. 예를 들어,#IMPORT [MIN, 240, TEST] AS VAR240240분 기간 (4시간) K-라인 같은 데이터를 가져오기 위해

        코드 예제:

        // This code demonstrates how to reference formulas of different periods in the same code
        // #EXPORT extended grammar, ending with #END marked as a formula, you can declare multiple
        #EXPORT TEST 
        Mean value 1: EMA(C, 20);
        Mean value 2: EMA(C, 10);
        #END // end
        
        #IMPORT [MIN,15,TEST] AS VAR15 // Quoting the formula, the K-line period takes 15 minutes
        #IMPORT [MIN,30,TEST] AS VAR30 // Quoting the formula, the K-line period takes 30 minutes
        CROSSUP(VAR15.Mean value is 1, VAR30.Mean value is 1),BPK;
        CROSSDOWN(VAR15.Mean value is 2, VAR30.Mean value is 2),SPK;
        The highest price in fifteen minutes:VAR15.HIGH;
        The highest price in thirty minutes:VAR30.HIGH;
        AUTOFILTER;
        
      • 이 약물을 복용할 때 주의가 필요합니다.REF, LLV, HHV그리고 여러 기간의 데이터를 참조할 때 데이터를 참조하는 다른 지침.

        (*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 // end      
        
        #IMPORT [MIN,5,TEST] AS MIN5
        INFO(1, 'C:', C, 'MIN5.REF1C:', MIN5.REF1C, 'REF(MIN5.C, 1):', REF(MIN5.C, 1), 'Trigger BAR time:', BARTIME, '#FF0000');
        INFO(1, 'L:', L, 'MIN5.REF1L:', MIN5.REF1L, 'REF(MIN5.L, 1):', REF(MIN5.L, 1), 'Trigger BAR time:', BARTIME, '#32CD32');
        AUTOFILTER;
        

        이 두 가지의 차이를 비교해 보면MIN5.REF1C그리고REF(MIN5.C, 1)우리는 찾을 수 있습니다:MIN5.REF1C5분 K 라인 데이터의 현재 순간에 준 마지막 BAR의 종료 가격의 값입니다.REF(MIN5.C, 1)현재 모델의 K-라인 기간 (위 코드 백테스트 기간은 1분, 즉 ```period: 1m``로 설정되어 있습니다), 현재 순간에 penultimate BAR가 있는 5분 기간의 종료 가격입니다. 이 두 가지 정의는 구별되며 필요에 따라 사용할 수 있습니다.

    • 모드 설명

      • 하나의 열과 하나의 평준화 신호 필터링 모델

        모델에서,AUTOFILTER이 함수는 하나의 개척과 하나의 폐쇄의 신호 필터링을 제어하고 실현하기 위해 작성되었습니다. 조건에 부합하는 여러 개의 개척 신호가 있을 때, 첫 번째 신호는 유효 신호로 간주되며, K-라인에서 동일한 신호가 필터링됩니다.

        필터링 모델에 의해 지원되는 명령어: BK, BP, BPK, SK, SP, SPK, CLOSEOUT, 등. BK ((5) 같은 롯 번호가 있는 명령어는 지원되지 않습니다.

        예를 들어

        MA1:MA(CLOSE,5);
        MA2:MA(CLOSE,10);
        CROSSUP(C,MA1),BK;
        CROSSUP(MA1,MA2),BK;
        C>BKPRICE+10||C<BKPRICE-5,SP;
        AUTOFILTER;
        
        Comprehension:
        As in the above example, when AUTOFILTER is not set, the third row BK, the fourth row BK and the fifth row SP are triggered in sequence, and each K-line triggers a signal once. After opening the position, and closing the position, the model state is reset.      
        If AUTOFILTER is set, after triggering BK, only SP is triggered, other BK signals are ignored, and each K-line triggers a signal once.
        
      • 증가 및 감소 위치 모델

        AUTOFILTER이 함수는 모델에 기록되지 않아 연속적인 개시 신호나 연속적인 폐쇄 신호가 가능하며, 이는 포지션을 증가시키고 감소시킬 수 있습니다.

        지원된 명령어: BK(N), BP(N), SK(N), SP(N), CLOSEOUT, BPK(N), SPK(N, 롯 크기가 없는 오픈 및 클로즈 오더는 지원되지 않습니다. (1) 명령어 그룹화는 지원됩니다. (2) 여러 명령 조건이 동시에 충족되면, 신호는 조건 명령어가 작성된 순서대로 실행됩니다. 예를 들어:

        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);
        

        사용TRADE\_AGAIN동일한 명령 줄에서 여러 개의 신호를 연속으로 만들 수 있습니다.

        Comprehension:
        The above example is executed one by one, and the signal after execution is no longer triggered. Reset the model status after closing the position. A K -line triggers a signal once.
        
      • 하나의 K선과 하나의 신호를 가진 모델

        K-라인이 완료되었는지 여부에 관계없이, 신호는 실시간 순서로 계산됩니다. 즉, K-라인은 순서가 완료되기 전에 배치됩니다. K-라인은 끝에서 검토됩니다. 위치 방향이 K-라인 끝의 신호 방향과 일치하지 않으면 위치가 자동으로 동기화됩니다.

        예를 들어:

        MA1:MA(CLOSE,5);
        MA2:MA(CLOSE,10);
        CROSSUP(MA1,MA2),BPK;    //The 5-period moving average crosses up, and the 10-period moving average goes long.
        CROSSDOWN(MA1,MA2),SPK;  //The 5-period moving average crosses down, and the 10-period moving average goes short.
        AUTOFILTER;
        
      • 하나의 K-라인에서 여러 신호의 모델

        이 모델은multsig하나의 K-라인에서 여러 신호를 제어하고 구현하기 위해

        K-라인 완성 여부와 상관없이 신호는 실시간으로 계산됩니다.

        신호는 검토되지 않고 신호가 사라지지 않고 신호의 방향은 항상 위치 방향과 일치합니다.

        하나의 K-라인에서 여러 신호 조건이 충족되면 반복적으로 실행될 수 있습니다.

        For example:
        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);
        

        MULTSIG하나의 K-라인 내에서 여러 명령줄을 실행할 수 있습니다. 명령줄은 한 번만 신호를 보내죠.

        O<C,BK;            // These conditions may all be executed in a K-line Bar, but only one signal per line
        10+O<C,BK;         // Strategy plus TRADE_AGAIN(10);it can make multiple signals per line
        20+O<C,BK;
        40+O<C,BK;
        MULTSIG(1,1,10);
        

        보충: 1.시스템은 시그널과 K-라인의 두 가지 방식인 포지션 추가 및 감소 모델을 지원합니다. 2.포지션을 더하고 줄이는 모델은 또한 하나의 K-라인에서 여러 신호의 순서를 지원합니다. 포지션의 덧셈과 셈의 모델은multsig하나의 K-선에서 여러 가지 덧셈이나 여러 가지 절감을 실현하는 기능입니다.

    • 실행 모드

      img

      • 바 모델

        바 모델은 현재 바가 완료된 후에 실행되는 모델을 의미하며, 거래는 다음 바가 시작되면 실행됩니다.

      • 틱 모델

        틱 모델은 모델이 각 가격 움직임에 한 번 실행되고 신호가 있을 때 즉시 거래된다는 것을 의미합니다. 틱 모델은 전날의 신호를 무시하고 (전날의 신호는 같은 날 즉시 실행되며), 틱 모델은 신호가 트리거되는지를 결정하기 위해 현재 시장 데이터에만 초점을 맞추고 있습니다.

    • 차트 표시

      • 주요 차트에 대한 추가 지표

        연산자를 사용^^, 세트 인디케이터는 변수에 값을 할당하는 동안 주요 차트에 표시됩니다.

        MA60^^MA(C, 60);  // Calculate the average indicator with the parameter of 60
        

        img

      • 부차표의 추가 지표

        연산자를 사용:, 세트 인디케이터는 변수에 값을 할당하는 동안 하위 차트에 표시됩니다.

        ATR:MA(MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW)),26);    // Assign a value to the ATR variable, the ":" symbol is followed by the formula for calculating the ATR
        

        img

        메인 차트나 서브 차트에서 표시되는 것을 원하지 않는다면, ... 연산자를 사용하세요.

        MA60..MA(C, 60);  // Calculate the average indicator with the parameter of 60
        

        당신은 사용할 수 있습니다DOT그리고COLORREDMyLanguage에 익숙한 사용자들의 습관에 맞춰 줄의 종류와 줄의 색상을 설정합니다.

    • 일반적인 문제

      소개합니다문제일반적으로 표시를 작성하는 과정에서 흔히 발견되는 것, 일반적으로 작성할 때 주의를 기울여야 할 점 (지속적으로 추가됩니다).

      • 세미콜론을 참고하세요.;마지막에.

      • 시스템 키워드는 변수로 선언할 수 없다는 점에 유의하십시오.

      • 문자열이단일 코팅예를 들어: 문자열'Open position'.

      • 언급

        해설자

        • // The Remark content(입문 방법은 중국어와 영어로 모두 입력 할 수 있습니다) 코드가 실행 과정에서 컴파일되지 않습니다, 즉//일반적으로 코드를 표시하는 데 사용되는데, 코드를 검토할 때 편리하면 빠르게 이해하고 기억할 수 있습니다.

        • { Remark content }막연한 언급.

          A:=MA(C,10);
          {The previous line of code is to calculate the moving average.}
          
        • (* Remark content *)막연한 언급.

          A:=MA(C,10);
          (*The previous line of code is to calculate the moving average.*)
          
      • 입력

        코드를 작성할 때, 입력 방법은 종종 중국어와 영어 사이에서 전환되기 때문에 기호 오류가 발생합니다. 일반적인 오류는 다음과 같습니다.:터미네이터;오차,, 괄호()이 문자는 중국어와 영어의 다른 상태에서 주의가 필요합니다.

        소구, 바이두, 또는 Bing 입력 방법을 사용하는 경우, 중국어와 영어 사이를 빠르게 전환 할 수 있습니다shift한 번 열쇠.

      • 오류가 발생하기 쉬운 논리

        1. 최소, 최소, 최소: 해당 관계 연산자>=.
        2. 최대: 해당 관계 연산자<=.
      • 전략 발사 동기화

        미래에셋 전략에서는 전략 로봇이 시작하기 전에 수동으로 열리는 포지션이 있다면, 로봇이 시작하면 포지션 정보를 감지하고 실제 포지션 상태에 동기화합니다. 전략에서, 당신은SP, BP, CLOSEOUT포지션을 닫는 명령

        %%
        if (!scope.init) {
            var ticker = exchange.GetTicker();
            exchange.Buy(ticker.Sell+10, 1);
            scope.init = true;
        }
        %%
        C>0, CLOSEOUT;
        
      • 양방향 포지션은 지원되지 않습니다.

        MyLanguage는 같은 계약에 대해 긴 포지션과 짧은 포지션을 지원하지 않습니다.

  • K선 데이터 인용

    • 오픈

      K-라인 차트의 시작 가격을 얻으십시오.

      개시 가격

      기능: OPEN, O의 약자

      매개 변수: 아무것도

      설명: 이 기간의 개시 가격을 반환합니다

      염기서열 데이터

      OPEN gets the opening price of the K-line chart.
      
      Remark:
      1.It can be abbreviated as O.
      
      Example 1:
      OO:=O;           //Define OO as the opening price; Remark that the difference between O and 0.
      Example 2:
      NN:=BARSLAST(DATE<>REF(DATE,1));
      OO:=REF(O,NN);   //Take the opening price of the day
      Example 3:
      MA5:=MA(O,5);    //Define the 5-period moving average of the opening price (O is short for OPEN).
      
    • 높은

      K-라인 차트에서 가장 높은 가격을 얻으십시오.

      가장 높은 가격

      기능: HIGH, 줄여서 H

      매개 변수: 아무것도

      설명: 이 기간의 가장 높은 가격을 반환합니다.

      염기서열 데이터

      HIGH achieved the highest price on the K-line chart.
      
      Remark:
      1.It can be abbreviated as H.
      
      Example 1:
      HH:=H;         // Define HH as the highest price
      Example 2:
      HH:=HHV(H,5);  // Take the maximum value of the highest price in 5 periods
      Example 3:
      REF(H,1);      // Take the highest price of the previous K-line
      
    • 낮은

      K-라인 차트에서 가장 낮은 가격을 구하세요.

      가장 낮은 가격

      기능: LOW, 줄여서 L

      매개 변수: 아무것도

      설명: 이 기간 중 가장 낮은 가격을 반환합니다.

      염기서열 데이터

      LOW gets the lowest price on the K-line chart.
      
      Remark:
      1.It can be abbreviated as L.
      
      Example 1:
      LL:=L;            // Define LL as the lowest price
      Example 2:
      LL:=LLV(L,5);     // Get the minimum value of the lowest price in 5 periods
      Example 3:
      REF(L,1);         // Get the lowest price of the previous K-line
      
    • 근접

      K-라인 차트의 폐쇄 가격을 얻으십시오.

      종료 가격

      기능: CLOSE, C로 줄여서

      매개 변수: 아무것도

      설명: 이 기간의 종료 가격을 반환합니다

      염기서열 데이터

      CLOSE Get the closing price of the K-line chart
      
      Remarks:
      1.Obtain the latest price when the intraday K-line has not finished.
      2.It can be abbreviated as C.
      
      Example 1:
      A:=CLOSE;          //Define the variable A as the closing price (A is the latest price when the intraday K-line has not finished)
      Example 2:
      MA5:=MA(C,5);      //Define the 5-period moving average of the closing price (C is short for CLOSE)
      Example 3:
      A:=REF(C,1);       //Get the closing price of the previous K-line
      
    • VOL

      K-line 차트의 거래 부피를 얻으십시오.

      거래량

      기능: VOL, 줄여서 V

      매개 변수: 아무것도

      설명: 이 기간의 거래량을 반환합니다.

      염기서열 데이터

      VOL obtains the trading volume of the K-line chart.
      
      Remarks:
       It can be abbreviated as V.
      The return value of this function on the current TICK is the cumulative value of all TICK trading volume on that day.
      
      Example 1:
      VV:=V;       // Define VV as the trading volume
      Example 2:
      REF(V,1);    // Indicates the trading volume of the previous period
      Example 3:
      V>=REF(V,1); // The trading volume is greater than the trading volume of the previous period, indicating that the trading volume has increased (V is the abbreviation of VOL)
      
    • OPI

      선물 (계약) 시장의 현재 총 지위를 취하십시오.

      OpenInterest:OPI;
      
    • REF

      앞장서서 인용.

      Reference the value of X before N periods.
      
      Remarks:
      1.When N is a valid value, but the current number of K-lines is less than N, returns null;
      2.Return the current X value when N is 0;
      3.Return a null value when N is null.
      4.N can be a variable.
      
      Example 1:
      REF(CLOSE,5);Indicate the closing price of the 5th period before the current period is referenced
      Example 2:
      AA:=IFELSE(BARSBK>=1,REF(C,BARSBK),C);//Take the closing price of the K-line of the latest position opening signal
      // 1)When the BK signal is sent, the bar BARSBK returns null, then the current K-line REF(C, BARSBK) that sends out the BK signal returns null;
      // 2)When the BK signal is sent out, the K-line BARSBK returns null, and if BARSBK>=1 is not satisfied, it is the closing price of the K-line.
      // 3)The K-line BARSBK after the BK signal is sent, returns the number of periods from the current K-line between the K-line for purchasing and opening a position, REF(C,BARSBK)
      Return the closing price of the opening K-line.
      // 4)Example: three K-lines: 1, 2, and 3, 1 K-line is the current K-line of the position opening signal, then returns the closing price of the current K-line, 2, 3
      The K-line returns the closing price of the 1 K-line.
      
    • UNIT

      데이터 계약의 거래 단위를 가져와

      Get the trading unit of the data contract.
      Usage:
      UNIT takes the trading unit of the loaded data contract.
      

      암호화폐 현금 거래

      UNIT 값은 1입니다

      암호화폐 선물

      UNIT 값은 계약 통화와 관련이 있습니다.

      OKEX futures currency standard contracts: 1 contract for BTC represents $100, 1 contract for other currencies represents $10
      
    • MINPRICE

      데이터 계약의 최소 변동 가격

      Take the minimum variation price of the data contract.
      Usage:
      MINPRICE; Take the minimum variation price of the loaded data contract.
      
    • MINPRICE1

      거래 계약의 최소 변동 가격

      Take the minimum variation price of a trading contract.
      Usage:
      MINPRICE1; Take the minimum variation price of a trading contract.
      
  • 시간 함수

    • BARPOS

      K-라인 위치를 잡아요.

      BARPOS, Returns the number of periods from the first K-line to the current one.
      
      Remarks:
      1.BARPOS returns the number of locally available K-line, counting from the data that exists on the local machine.
      2.The return value of the first K-line existing in this machine is 1.
      
      Example 1:LLV(L,BARPOS);        // Find the minimum value of locally available data.
      
      Example 2:IFELSE(BARPOS=1,H,0); // The current K-line is the first K-line that already exists in this machine, and it takes the highest value, otherwise it takes 0.
      
    • DAYBARPOS

      DAYBARPOS 현재 K-라인 BAR는 K-라인 BAR입니다.

    • 기간

      기간 값은 분 수입니다.

      1, 3, 5, 15, 30, 60, 1440
      
    • 날짜

      날짜함수 DATE, 1 9 00 년 이후 기간의 해, 달 및 날을 얻으십시오.

      Example 1:
      AA..DATE;                  // The value of AA at the time of testing is 220218, which means February 18, 2022
      
    • 시간

      K-라인을 하는 시간입니다.

      TIME, the time of taking the K-line.
      
      Remarks:
      1.The function returns in real time in the intraday, and returns the starting time of the K-line after the K-line is completed.
      2.This function returns the exchange data reception time, which is the exchange time.
      3.The TIME function returns a six-digit form when used on a second period, namely: HHMMSS, and displays a four-digit form on other periods, namely: HHMM.
      4.The TIME function can only be loaded in periods less than the daily period, and the return value of the function is always 1500 in the daily period and periods above the daily period.
      5. It requires attention when use the TIME function to close a position at the end of the day
      (1).It is recommended to set the time for closing positions at the end of the market to the time that can actually be obtained from the return value of the K-line (for example: the return time of the last K-line in the 5-minute period of the thread index is 1455, and the closing time at the end of the market is set to TIME>=1458, CLOSEOUT; the signal of closing the position at the end of the market cannot appear in the effect test)
      (2).If the TIME function is used as the condition for closing the position at the end of the day, it is recommended that the opening conditions should also have a corresponding time limit (for example, if the condition for closing the position at the end of the day is set to TIME>=1458, CLOSEOUT; then the condition TIME needs to be added to the corresponding opening conditions. <1458; avoid re-opening after closing)
      
      Example 1:
      C>O&&TIME<1450,BK;
      C<O&&TIME<1450,SK;
      TIME>=1450,SP;
      TIME>=1450,BP;
      AUTOFILTER;
      // Close the position after 14:50.
      Example 2:
      ISLASTSK=0&&C>O&&TIME>=0915,SK;
      
    • 1년

      Year.

      YEAR, year of acquisition.
      
      Remark:
      The value range of YEAR is 1970-2033.
      
      Example 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);                               // Take the highest price, lowest price, opening price, and closing price of the previous year
      Example 2:
      NN:=IFELSE(YEAR>=2000 AND MONTH>=1,0,1);
      
    • 한 달만 가져가

      MONTH, returns the month of a period.
      
      Remark:
      The value range of MONTH is 1-12.
      
      Example 1:
      VALUEWHEN(MONTH=3&&DAY=1,C);                // Take its closing price when the K-line date is March 1
      Example 2:
      C>=VALUEWHEN(MONTH<REF(MONTH,1),O),SP;
      
    • 1일

      기간에 있는 날 수를 얻으세요

      DAY, returns the number of days in a period.
      
      Remark:
      The value range of DAY is 1-31.
      
      Example 1:
      DAY=3&&TIME=0915,BK;                      // 3 days from the same day, at 9:15, buy it
      Example 2:
      N:=BARSLAST(DATE<>REF(DATE,1))+1;
      CC:=IFELSE(DAY=1,VALUEWHEN(N=1,O),0);      // When the date is 1, the opening price is taken, otherwise the value is 0
      
    • 시간

      Hour.

      HOUR, returns the number of hours in a period.
      
      Remark:
      The value range of HOUR is 0-23
      
      Example 1:
      HOUR=10;                                   // The return value is 1 on the K-line at 10:00, and the return value on the remaining K-lines is 0
      
    • 1분

      Minute.

      MINUTE, returns the number of minutes in a period.
      
      Remarks:
      1: The value range of MINUTE is 0-59
      2: This function can only be loaded in the minute period, and returns the number of minutes when the K-line starts.
      Example 1:
      MINUTE=0;                                 // The return value of the minute K-line at the hour is 1, and the return value of the other K-lines is 0
      Example 2:
      TIME>1400&&MINUTE=50,SP;                   // Sell and close the position at 14:50
      
    • 주일

      이번 주 번호를 찾아봐

      WEEKDAY, get the number of the week.
      
      Remark:
      1: The value range of WEEKDAY is 0-6. (Sunday ~ Saturday)
      
      Example 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;                               // Automatically close positions at the end of the monthly delivery day
      Example 2:
      C>VALUEWHEN(WEEKDAY<REF(WEEKDAY,1),O)+10,BK;
      AUTOFILTER;
      
  • 논리적 판단 기능

    • 바르스타투스

      현재 기간의 위치 상태를 반환합니다.

      BARSTATUS returns the position status for the current period.
      
      Remark:
      The function returns 1 to indicate that the current period is the first period, returns 2 to indicate that it is the last period, and returns 0 to indicate that the current period is in the middle.
      
      Example:
      A:=IFELSE(BARSTATUS=1,H,0);              // If the current K-line is the first period, variable A returns the highest value of the K-line, otherwise it takes 0
      
    • 그 사이에

      Between.

      BETWEEN(X,Y,Z) indicates whether X is between Y and Z, returns 1 (Yes) if established, otherwise returns 0 (No).
      
      Remark:
      1.The function returns 1(Yse) if X=Y, X=Z, or X=Y and Y=Z.
      
      Example 1:
      BETWEEN(CLOSE,MA5,MA10);                // It indicates that the closing price is between the 5-day moving average and the 10-day moving average
      
    • BARSLASTCOUNT

      BARSLASTCOUNT(COND) 는 조건에 만족하는 연속 기간의 수를 계산합니다. 현재 기간부터 앞으로 계산합니다.

      Remark:
      1. The return value is the number of consecutive non zero periods calculated from the current period
      2. the first time the condition is established when the return value of the current K-line BARSLASTCOUNT(COND) is 1
      
      Example:
      BARSLASTCOUNT(CLOSE>OPEN);
      //Calculate the number of consecutive positive periods within the current K-line
      
    • 크로스

      크로스 기능

      CROSS(A,B) means that A crosses B from bottom to top, and returns 1 (Yes) if established, otherwise returns 0 (No)
      
      Remark:
      1.To meet the conditions for crossing, the previous k-line must satisfy A<=B, and when the current K-line satisfies A>B, it is considered to be crossing.
      
      Example 1:
      CROSS(CLOSE,MA(CLOSE,5));              // Indicates that the closing line crosses the 5-period moving average from below
      
    • 크로스다운

      크로스다운

      CROSSDOWN(A,B): indicates that when A passes through B from top to bottom, it returns 1 (Yes) if it is established, otherwise it returns 0 (No)
      
      Remark:
      1.CROSSDOWN(A,B) is equivalent to CROSS(B,A), and CROSSDOWN(A,B) is easier to understand
      
      Example 1:
      MA5:=MA(C,5);
      MA10:=MA(C,10);
      CROSSDOWN(MA5,MA10),SK;               // MA5 crosses down MA10 to sell and open a position
      // CROSSDOWN(MA5,MA10),SK; Same meaning as CROSSDOWN(MA5,MA10)=1,SK;
      
    • 크로스

      Crossup.

      CROSSUP(A,B) means that when A crosses B from the bottom up, it returns 1 (Yes) if it is established, otherwise it returns 0 (No)
      
      Remark:
      1.CROSSUP(A,B) is equivalent to CROSS(A,B), and CROSSUP(A,B) is easier to understand.
      
      Example 1:
      MA5:=MA(C,5);
      MA10:=MA(C,10);
      CROSSUP(MA5,MA10),BK;                 // MA5 crosses MA10, buy open positions
      // CROSSUP(MA5,MA10),BK;与CROSSUP(MA5,MA10)=1,BK; express the same meaning
      
    • 모두

      계속 만족하는지 확인합니다.

      EVERY(COND,N), Determine whether the COND condition is always satisfied within N periods. The return value of the function is 1 if it is satisfied, and 0 if it is not satisfied.
      
      Remarks:
      1.N contains the current K-line.
      2.If N is a valid value, but there are not so many K-lines in front, or N is a null value, it means that the condition is not satisfied, and the function returns a value of 0.
      3.N can be a variable.
      
      Example 1:
      EVERY(CLOSE>OPEN,5);                // Indicates that it has been a positive line for 5 periods
      Example 2:
      MA5:=MA(C,5);                       // Define a 5-period moving average
      MA10:=MA(C,10);                     // Define a 10-period moving average
      EVERY(MA5>MA10,4),BK;               // If MA5 is greater than MA10 within 4 periods, then buy the open position
      // EVERY(MA5>MA10,4),BK; has the same meaning as EVERY(MA5>MA10,4)=1,BK;
      
    • 존재합니다

      만족 여부를 판단하세요.

      EXIST(COND, N) judges whether there is a condition that satisfies COND within N periods.
      
      Remarks:
      1.N contains the current K-line.
      2.N can be a variable.
      3.If N is a valid value, but there are not so many K-lines in front, it is calculated according to the actual number of periods.
      
      Example 1:
      EXIST(CLOSE>REF(HIGH,1),10);     // Indicates whether there is a closing price greater than the highest price of the previous period in 10 periods, returns 1 if it exists, and returns 0 if it does not exist
      Example 2:
      N:=BARSLAST(DATE<>REF(DATE,1))+1;
      EXIST(C>MA(C,5),N);              // Indicates whether there is a K-line that satisfies the closing price greater than the 5-period moving average on the day, returns 1 if it exists, returns 0 if it does not exist
      
    • IF

      조건 함수

      IF(COND,A,B)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 the variable circular reference to the previous period's own variable, that is, supports the following writing Y: IF(CON,X,REF(Y,1)).
      Example 1:
      IF(ISUP,H,L);                   // The K-line is the positive line, the highest price is taken, otherwise the lowest price is taken
      Example 2:
      A:=IF(MA5>MA10,CROSS(DIFF,DEA),IF(CROSS(D,K),2,0));     // When MA5>MA10, check whether it satisfies the DIFF and pass through DEA, otherwise (MA5 is not greater than MA10), when K and D are dead fork, let A be assigned a value of 2, if none of the above conditions are met, A is assigned a value of 0
      A=1,BPK;                                                // When MA5>MA10, the condition for opening a long position is to cross DEA above the DIFF
      A=2,SPK;                                                // When MA5 is not greater than MA10, use K and D dead forks as the conditions for opening short positions
      
    • IFELSE

      조건 함수

      IFELSE(COND,A,B) 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 Y: IFELSE(CON,X,REF(Y,1));
      Example 1:
      IFELSE(ISUP,H,L);                                             // The K-line is the positive line, the highest price is taken, otherwise the lowest price is taken
      Example 2:
      A:=IFELSE(MA5>MA10,CROSS(DIFF,DEA),IFELSE(CROSS(D,K),2,0));   // When MA5>MA10, check whether it satisfies the DIFF and pass through DEA, otherwise (MA5 is not greater than MA10), when K and D are dead fork, let A be assigned a value of 2, if none of the above conditions are met, A is assigned a value of 0
      A=1,BPK;                                                      // When MA5>MA10, the condition for opening a long position is to cross DEA above the DIFF
      A=2,SPK;                                                      // When MA5 is not greater than MA10, use K and D dead forks as the conditio

관련

더 많은