シンプル・ボラティリティ・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の価値もゼロに近い.したがって,EMVはほとんどの市場でゼロ軸以下にあり,これはこの指標の主要な特徴でもあります.別の観点から,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契約に関する他の情報を知りたい場合は,このデータを受信するために変数も使用できます.GetRecords変数を使用します. 変数式は,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

オーダーを出す前に,我々は2つのデータを決定する必要があります. 1つはオーダーの価格であり,もう1つは現在のポジションの状態です. オーダーを出す価格は非常に簡単です.get_position最後に,位置は EMV とゼロ軸の位置関係に応じて開閉されます.

戦略のバックテスト

バックテスト設定

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はボリュームデータを導入しているため,価格の背後にあるものを調べるために価格計算を使用する他の技術指標よりも効果的です.各戦略には異なる特徴があります.異なる戦略のメリットとデメリットを完全に理解し,ゴミを取り除き,その本質を抽出することでのみ,私たちは成功からさらに遠ざかることができます.


関連性

もっと