단순 변동성 EMV 전략

저자:선함, 2020-07-01 10:39:17, 업데이트: 2023-10-28 15:26:49

img

요약

다른 기술 지표와 달리, Ease of Movement Value (운동 가치의 편의) 는 가격, 부피 및 인지도의 변화를 반영합니다. 그것은 가격과 부피의 변화를 결합하는 기술입니다. 가격 변동 지표를 형성하여 유닛 부피의 가격 변화를 측정합니다. 시장이 인기를 얻고 거래가 활성화되면 구매 신호를 발사합니다. 거래 부피가 낮고 시장 에너지가 고갈 될 때 판매 신호를 발사합니다.

간단한 변동성 EMV는 동일한 볼륨 차트와 압축 차트의 원칙에 따라 설계되었습니다. 그것의 핵심 개념은: 시장 가격은 트렌드가 전환되거나 전환 될 때만 많은 에너지를 소비하고 외부 성능은 거래량이 커지는 것입니다. 가격이 상승할 때, 부팅 효과로 인해 너무 많은 에너지를 소비하지 않습니다. 이 아이디어가 양과 가격 상승 두 가지 견해에 반대하지만, 그것은 고유한 특징을 가지고 있습니다.

EMV 계산 공식

단계 1: mov_mid를 계산합니다

그 중 TH는 하루의 가장 높은 가격을 나타내고 TL는 하루의 가장 낮은 가격을 나타내고 YH는 전날의 가장 높은 가격을 나타내고 YL는 전날의 가장 낮은 가격을 나타냅니다. MID> 0는 오늘의 평균 가격이 어제의 평균 가격보다 높다는 것을 의미합니다.

img

단계 2: 비율을 계산합니다.

그 중 TVOL는 하루 거래량을, TH는 하루 최고 가격을, TL는 하루 최저 가격을 나타냅니다.

img

단계 3: emv를 계산합니다.

img

EMV 사용

EMV의 저자는 거대한 상승이 에너지의 급속한 고갈에 동반되며 상승은 종종 너무 오래 지속되지 않는다고 믿습니다. 반대로, 일정 양의 에너지를 절약 할 수있는 온건한 부피는 상승을 더 오래 지속시킵니다. 상승 추세가 형성되면 거래 부피가 줄어들면 가격이 상승 할 수 있으며 EMV의 가치가 증가 할 것입니다. 하락 추세가 형성되면 시장은 종종 무한하거나 작은 감소로 동반되며 EMV의 가치가 감소 할 것입니다. 가격이 변동적인 시장에 있거나 가격 상승과 하락이 큰 부피로 동반되면 EMV의 가치도 0에 가깝게 될 것입니다. 따라서 EMV가 시장의 대부분에서 0축 아래에 있음을 알게 될 것입니다. 이것은 또한이 지표의 주요 특징입니다. 다른 관점에서 EMV 메가 트렌드는 충분한 수익을 창출 할 수 있습니다.

EMV의 사용은 매우 간단합니다. EMV가 제로 축을 통과하는지 살펴보십시오. EMV가 0보다 낮을 때 약한 시장을 나타냅니다. EMV가 0보다 높을 때 강한 시장을 나타냅니다. EMV가 음에서 양으로 변하면 구입해야합니다; EMV가 양에서 음으로 변하면 판매해야합니다. 그것의 특징은 시장의 충격 시장을 피할 수있을뿐만 아니라 트렌드 시장이 시작되는 시간에 시장에 진입 할 수 있다는 것입니다. 그러나 EMV가 가격이 변할 때 볼륨의 변화를 반영하기 때문에 중장기 트렌드에만 영향을 미칩니다. 단기 또는 비교적 짧은 거래 주기에 EMV의 효과는 매우 약합니다.

전략 실현

단계 1: 전략 프레임워크를 작성

# Strategy main function
def onTick():
     pass

# Program entry
def main():
     while True: # Enter infinite loop mode
         onTick() # execution strategy main function
         Sleep(1000) # sleep for 1 second

FMZ.COM회전 훈련 모드를 채택합니다. 먼저, 당신은main기능 및onTick기능.main함수는 전략의 입력 함수입니다. 그리고 프로그램은 코드 라인을main기능.main함수, a를 적어while루프를 반복해서 실행onTick전략의 모든 핵심 코드는onTick function.

단계 2: 위치 데이터를 얻으십시오

def get_position():
     position = 0 # The number of assigned positions is 0
     position_arr = _C(exchange.GetPosition) # Get array of positions
     if len(position_arr)> 0: # If the position array length is greater than 0
         for i in position_arr: # Traverse the array of positions
             if i['ContractType'] =='IH000': # If the position symbol is equal to the subscription symbol
                 if i['Type']% 2 == 0: # if it is long position
                     position = i['Amount'] # Assign a positive number of positions
                 else:
                     position = -i['Amount'] # Assign the number of positions to be negative
     return position # return position quantity

왜냐하면 이 전략에서는 유지보수를 촉진하기 위해 실시간 위치만 사용되기 때문입니다.get_position포지션의 양을 포괄하기 위해 사용됩니다. 현재 포지션이 길다면 긍정적 인 숫자를 반환하고, 현재 포지션이 짧으면 부정적인 숫자를 반환합니다.

단계 3: K-라인 데이터를 얻으십시오

exchange.SetContractType('IH000') # Subscribe to futures variety
bars_arr = exchange.GetRecords() # Get K-line array
if len(bars_arr) <10: # If the number of K lines is less than 10
     return

특정 K-라인 데이터를 얻기 전에 먼저 특정 거래 계약을 가입하고SetContractType함수에서FMZ.COM, 그리고 계약 코드를 입력합니다. 계약에 대한 다른 정보를 알고 싶다면, 당신은 또한 이 데이터를 수신하기 위해 변수를 사용할 수 있습니다.GetRecordsK선 데이터를 얻기 위한 함수입니다. 반환된 값은 배열이기 때문에 변수를 사용합니다.bars_arr받아들이기 위해서요.

단계 4: emv를 계산합니다

bar1 = bars_arr[-2] # Get the previous K-line data
bar2 = bars_arr[-3] # get the previous K-line data
# Calculate the value of mov_mid
mov_mid = (bar1['High'] + bar1['Low']) / 2-(bar2['High'] + bar2['Low']) / 2
if bar1['High'] != bar1['Low']: # If the dividend is not 0
     # Calculate the value of ratio
     ratio = (bar1['Volume'] / 10000) / (bar1['High']-bar1['Low'])
else:
     ratio = 0
# If the value of ratio is greater than 0
if ratio> 0:
     emv = mov_mid / ratio
else:
     emv = 0

여기서, 우리는 EMV의 값을 계산하기 위해 최신 가격을 사용하지 않고, 신호를 출력하고 명령을 내리기 위해 K 라인을 배치하기 위해 상대적으로 지연된 현재 K 라인을 사용합니다. 이의 목적은 실제 거래에 더 가까운 백테스트를 만드는 것입니다. 양적 거래 소프트웨어가 이제 매우 진보되었지만, 특히 바 레벨 긴 데이터의 백테스팅에 직면했을 때 실제 가격 틱 환경을 완전히 시뮬레이션하는 것이 여전히 어렵다는 것을 알고 있습니다. 따라서이 타협 방법이 사용됩니다.

단계 5: 주문을 하는 것

current_price = bars_arr[-1]['Close'] # latest price
position = get_position() # Get the latest position
if position> 0: # If you are holding long positions
    if emv <0: # If the current price is less than teeth
        exchange.SetDirection("closebuy") # Set the trading direction and type
        exchange.Sell(round(current_price-0.2, 2), 1) # close long position
if position <0: # If you are holding short positions
    if emv> 0: # If the current price is greater than the teeth
        exchange.SetDirection("closesell") # Set the trading direction and type
        exchange.Buy(round(current_price + 0.2, 2), 1) # close short position
if position == 0: # If there is no holding position
    if emv> 0: # If the current price is greater than the upper lip
        exchange.SetDirection("buy") # Set the trading direction and type
        exchange.Buy(round(current_price + 0.2, 2), 1) # open long position
    if emv <0: # if the current price is smaller than the chin
        exchange.SetDirection("sell") # Set the trading direction and type
        exchange.Sell(round(current_price-0.2, 2), 1) # open short position

주문을 하기 전에, 우리는 두 가지 데이터를 결정 해야 합니다, 하나는 주문의 가격이고 다른 하나는 현재 위치 상태입니다. 주문을 하는 가격은 매우 간단합니다, 그냥 현재 폐쇄 가격을 사용하여 다양성의 최소 변화 가격을 더하거나 빼기.get_position위치를 캡슐화하는 함수, 우리는 여기에 직접 호출 할 수 있습니다. 마지막으로, EMV와 0 축 사이의 위치 관계에 따라 위치가 열리고 닫습니다.

전략 백테스트

백테스트 구성

img

백테스트 로그

img img

자본 곡선

img

전체 전략

# Backtest configuration
'''backtest
start: 2019-01-01 00:00:00
end: 2020-01-01 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_CTP","currency":"FUTURES"}]
'''


def get_position():
     position = 0 # The number of assigned positions is 0
     position_arr = _C(exchange.GetPosition) # Get array of positions
     if len(position_arr)> 0: # If the position array length is greater than 0
         for i in position_arr: # Traverse the array of positions
             if i['ContractType'] =='IH000': # If the position symbol is equal to the subscription symbol
                 if i['Type']% 2 == 0: # if it is long position
                     position = i['Amount'] # Assign a positive number of positions
                 else:
                     position = -i['Amount'] # Assign the number of positions to be negative
     return position # return position quantity


# Strategy main function
def onTick():
     # retrieve data
     exchange.SetContractType('IH000') # Subscribe to futures
     bars_arr = exchange.GetRecords() # Get K-line array
     if len(bars_arr) <10: # If the number of K lines is less than 10
         return

     # Calculate emv
     bar1 = bars_arr[-2] # Get the previous K-line data
     bar2 = bars_arr[-3] # get the previous K-line data
     # Calculate the value of mov_mid
     mov_mid = (bar1['High'] + bar1['Low']) / 2-(bar2['High'] + bar2['Low']) / 2
     if bar1['High'] != bar1['Low']: # If the dividend is not 0
          # Calculate the value of ratio
          ratio = (bar1['Volume'] / 10000) / (bar1['High']-bar1['Low'])
     else:
          ratio = 0
     # If the value of ratio is greater than 0
     if ratio> 0:
          emv = mov_mid / ratio
     else:
          emv = 0

     # Placing orders
     current_price = bars_arr[-1]['Close'] # latest price
     position = get_position() # Get the latest position
     if position> 0: # If you are holding long positions
          if emv <0: # If the current price is less than teeth
               exchange.SetDirection("closebuy") # Set the trading direction and type
               exchange.Sell(round(current_price-0.2, 2), 1) # close long position
     if position <0: # If you are holding short positions
          if emv> 0: # If the current price is greater than the teeth
               exchange.SetDirection("closesell") # Set the trading direction and type
               exchange.Buy(round(current_price + 0.2, 2), 1) # close short position
     if position == 0: # If there is no holding position
          if emv> 0: # If the current price is greater than the upper lip
               exchange.SetDirection("buy") # Set the trading direction and type
               exchange.Buy(round(current_price + 0.2, 2), 1) # open long position
     if emv <0: # if the current price is smaller than the chin
               exchange.SetDirection("sell") # Set the trading direction and type
               exchange.Sell(round(current_price-0.2, 2), 1) # open short position

# Program entry
def main():
     while True: # Enter infinite loop mode
         onTick() # execution strategy main function
         Sleep(1000) # sleep for 1 second

전체 전략은FMZ.COM이 웹사이트는 복사 버튼을 눌러서 사용할 수 있습니다.https://www.fmz.com/strategy/213636

요약하면

이 연구 과정을 통해 우리는 EMV가 일반 상인들과는 반대되는 것을 볼 수 있지만, 그것은 불합리하지 않습니다. EMV가 볼륨 데이터를 도입하기 때문에 가격 계산을 사용하여 가격 뒤에있는 것을 알아내는 다른 기술 지표보다 더 효과적입니다. 각 전략은 다른 특성을 가지고 있습니다. 다른 전략의 장단점을 완전히 이해하고 쓰레기를 제거하고 본질을 추출하는 것만이 성공을 통해 더 나아갈 수 있습니다.


관련

더 많은