MyQuant トレンド識別子戦略

作者: リン・ハーンチャオチャン開催日:2024年2月22日 16:04:04
タグ:

img

概要

MyQuantトレンド識別子戦略は,ビットコインの日常取引のための戦略である.移動平均値と価格の第1順位および第2順位衍生値を計算して市場のトレンドを特定し,それに応じて購入および販売の決定を下す.

戦略原則

この戦略は,まず価格とその第一順位および第二順位デリバティブの適応移動平均 (ALMA) を計算する.第一順位デリバティブは価格の変動率を反映し,第二順位デリバティブは価格の曲率を反映する.その後,第1順位デリバティブの値に基づいて現在の傾向が上昇,下落または変動する判断する.株式指標と組み合わせて,購入または販売条件が満たされているかどうかを決定する.

具体的には,戦略は以下の指標を計算します.

  • ALMA: 価格の適性移動平均,長さ140,速い因数1.1,シグマ6
  • dema: ALMA の第1順位派生金
  • d2ema: 価格の第2順位デリバティブを反映する dema の第1順位デリバティブ
  • インデックス: デマ指標の振動指数
  • ind: 価格の移動平均値からの偏差指数

購入条件が満たされると,CAUSED蓄積/配分帯とCAUSEDエクスポージャートップとボトムファインダーからの信号に基づいて購入する株の数を計算します.販売条件が満たされると,すべての現在のポジションを販売します.

戦略 の 利点

この戦略は,トレンドと指標判断を組み合わせることで,市場のトレンドのターニングポイントを効果的に特定することができます.トレンドを決定するために価格の第1順位と第2順位の派生物を使用することで,価格変動の影響が避けられ,シグナルがより明確になります.一般的な移動平均戦略と比較して,より高い精度などの利点があります.

リスク分析

この戦略は,取引時間期間とパラメータ調整の選択に非常に敏感である.時間期間が正しく選択され,重要な価格ターニングポイントがカバーされていない場合,戦略はあまり効果的ではない.指標パラメータが正しく設定されていない場合,購入・販売信号は騒音によりより影響を受け,戦略リターンに影響を与えます.また,戦略で事前に設定されたストップ・ロスの条件は最終リターンにも影響します.

最適化 に 関する 指示

この戦略は,次の側面においてさらに最適化することができる.

  1. バックテストとライブ取引の時間をよりスマートに選択することで,時間帯を選択するための論理を最適化します.
  2. ALMAやDEMAの長さを調整するなどの指標パラメータを最適化する.
  3. 最大損失を制御するためにストップ損失条件判断を追加します.
  4. 異なる暗号通貨の影響を評価し 最高のパフォーマンスを発揮するものを選びます

結論

MyQuantのトレンド識別子戦略は,価格の順応性移動平均値の1番目と2番目派生数を計算することによって,ビットコインの市場傾向を効果的に特定し,それに対応する購入・販売決定を下す.判断のための複数の指標を組み合わせることで,信号に過剰なノイズ干渉を回避する.時間とパラメータのさらなる最適化により,この戦略のパフォーマンスはさらに向上することができる.


/*backtest
start: 2023-02-15 00:00:00
end: 2024-02-21 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © spacekadet17
// 
//@version=5

strategy(title="Trend Identifier Strategy", shorttitle="Trend Identifier Strategy", format=format.price, precision=4, overlay = false, initial_capital = 1000, pyramiding = 10, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, commission_type = strategy.commission.percent, commission_value = 0.03)

//start-end time
startyear = input.int(2020,"start year")
startmonth = input.int(1,"start month")
startday = input.int(1,"start day")
endyear = input.int(2025,"end year")
endmonth = input.int(1,"end month")
endday = input.int(1,"end day")

timeEnd = time <= timestamp(syminfo.timezone,endyear,endmonth,endday,0,0)
timeStart = time >= timestamp(syminfo.timezone,startyear,startmonth,startday,0,0)
choosetime = input(false,"Choose Time Interval")
condTime = (choosetime ? (timeStart and timeEnd) : true)

// time frame?
tfc = 1
if timeframe.isdaily
    tfc := 24

// indicators: price normalized alma, and its 1st and 2nd derivatives
ema = ta.alma(close,140,1.1,6)
dema = (ema-ema[1])/ema
stodema = ta.ema(ta.ema(ta.stoch(dema,dema,dema,100),3),3)

d2ema = ta.ema(dema-dema[1],5)
stod2ema = ta.ema(ta.ema(ta.stoch(d2ema,d2ema,d2ema,100),3),3)

ind = (close-ta.ema(close,120*24/tfc))/close
heat = ta.ema(ta.stoch(ind,ind,ind,120*24/tfc),3)
index = ta.ema(heat,7*24/tfc)

//plot graph
green = color.rgb(20,255,100)
yellow = color.yellow
red = color.red
blue = color.rgb(20,120,255)
tcolor = (dema>0) and (d2ema>0)? green : (dema>0) and (d2ema<0) ? yellow : (dema < 0) and (d2ema<0) ? red : (dema < 0) and (d2ema>0) ? blue : color.black
demaema = ta.ema(dema,21)
plot(demaema, color = tcolor)

//strategy buy-sell conditions
cond1a = strategy.position_size <= 0
cond1b = strategy.position_size > 0

if (condTime and cond1a and ( ( ((tcolor[1] == red and demaema<0.02) or (tcolor[1] == blue and demaema < 0.02) or (tcolor[1] == yellow and demaema>-0.02) ) and tcolor == green) or (tcolor[1] == red and tcolor == blue and demaema < -0.01) ) and index<85 and ind<0.4)
    strategy.entry("buy",strategy.long, (strategy.equity-strategy.position_size*close)/1/close)
    
if (condTime and cond1b and ( (((tcolor[1] == yellow and demaema > -0.02) or (tcolor[1] == blue and demaema < 0.02) or (tcolor[1] == green and demaema < 0.02)) and tcolor == red) or (tcolor[1] == green and tcolor == yellow and demaema > 0.015) ) and index>15 and ind>-0.1)
    strategy.order("sell",strategy.short, strategy.position_size)


もっと