アリゲーター長期トレンドフォロー取引戦略

SMMA SMA
作成日: 2024-05-17 15:40:13 最終変更日: 2024-05-17 15:40:13
コピー: 4 クリック数: 718
1
フォロー
1617
フォロワー

アリゲーター長期トレンドフォロー取引戦略

概要

アリガターの長期トレンドフォロー取引戦略は,ウィリアムズ・アリガター指数に基づく量的な取引戦略である.この戦略は,異なる周期の移動平均の組み合わせを使用して,市場の主要なトレンドを捕捉し,中長期トレンドフォロー取引に適用される.戦略の主な考え方は,アリガターの指数の開口方向と価格とアリガターの指数の相対的な位置によってトレンドの方向と強さを判断して,取引決定を行うことである.

戦略原則

Alligatorの長期トレンドトラッキング取引戦略は,3つの異なる周期の移動平均を使用して,次のように Alligatorの指標を構築しています.

  1. Jaw線:13回転SMMA,未来へ平行8根K線
  2. Teeth線:8回転SMMA,未来に平行 5根K線
  3. Lips線:5周期SMMA,未来へ平移 3根K線

アリガター指数の開口方向が上方,つまり,Jaw線が最下,Teeth線が最中,Lips線が最上で,価格がアリガター指数の上方であるとき,戦略はポジションを多く開きます. この状況は,上向きのトレンドの波が確認されていることを示しています.

価格が Jaw ラインを下回ると,戦略は多項を平準化します. これは,私たちが熊市でポジションを継続しないことを保証します.

戦略的優位性

  1. 中長期取引に適しています.この戦略は,アリガター指標に基づいています.
  2. 取引頻度が低い:戦略は,トレンドが形成されたときにのみポジションを開き,トレンドが終了したときに平仓,取引頻度が比較的低く,取引コストを効果的に削減できます.
  3. 適用範囲:この戦略は,外国為替,暗号通貨などの様々な金融市場に適用でき,非常に強い適応性と柔軟性を持っています.
  4. パラメータを最適化する必要はありません. 戦略は市場動向に完全に従い,パラメータを最適化する必要はありません. シンプルで使いやすいです.

戦略リスク

  1. 潜在的スライドリスク:市場の激しい変動や流動性の欠如により,取引注文が予想価格で取引できない可能性があり,スライドリスクが生じます.
  2. 固定的リスク管理の欠如:この戦略には固定的リスク管理の設定がなく,それぞれの取引のポジションの大きさを自分のリスク好みに合わせて調整する必要があります.
  3. 短期間の機会を逃す可能性: 戦略が中長期のトレンドを捉えることに焦点を当てているため,短期間の取引機会を逃す可能性があります.

戦略最適化の方向性

  1. リスク管理モジュールへの追加: リスク管理のためのいくつかの措置,例えば,ストップ・ロズ,ダイナミック・ポジション・アディジュエーションなどの追加を検討して,リスクをよりよくコントロールできます.
  2. 他の技術指標と組み合わせる:戦略の正確性と信頼性を高めるために,RSI,MACDなどの他の技術指標と組み合わせる方法.
  3. 最適化パラメータ設定:この戦略ではパラメータを最適化する必要はありませんが,異なる時間周期と取引標識の反テストを試みて最適なパラメータの組み合わせを見つけることができます.

要約する

Alligatorの長期トレンド追跡取引戦略は,シンプルで使いやすい,幅広い範囲の定量取引戦略である. Alligatorの指標を利用して市場の主要トレンドを捕捉することで,この戦略は中長期にわたって安定した収益を得ることができる.戦略にはいくつかの潜在的なリスクがあるが,リスク管理モジュール,他の技術指標と組み合わせ,最適化パラメータ設定などの方法を加えることで,戦略の性能と安定性をさらに向上させることができる.

ストラテジーソースコード
/*backtest
start: 2023-05-11 00:00:00
end: 2024-05-16 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//_______ <licence>
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Skyrex

//_______ <version>
//@version=5

//_______ <declaration_statement>
strategy(title = "Alligator Long Term Trend Following Strategy [Skyrex.io]", 
         shorttitle = "Alligator Strategy [Skyrex.io]", 
         overlay = true, 
         format = format.inherit, 
         pyramiding = 1, 
         calc_on_order_fills = false, 
         calc_on_every_tick = true, 
         default_qty_type = strategy.percent_of_equity, 
         default_qty_value = 100, 
         initial_capital = 10000, 
         currency = currency.NONE,  
         commission_type = strategy.commission.percent, 
         commission_value = 0.1,
         slippage = 5)


//_______ <constant_declarations>
var color skyrexGreen = color.new(#2ECD99, 0)
var color skyrexGray = color.new(#F2F2F2, 0)
var color skyrexWhite = color.new(#FFFFFF, 0)

var color barcolor = na


//_______ <inputs>
// Trading bot settings
sourceUuid = input.string(title = "sourceUuid:", defval = "yourBotSourceUuid", group = "Trading Bot Settings")
secretToken = input.string(title = "secretToken:", defval = "yourBotSecretToken", group = "Trading Bot Settings")

// Trading Period Settings
lookBackPeriodStart = input(title = "Trade Start Date/Time", defval = timestamp('2023-01-01T00:00:00'), group = "Trading Period Settings")
lookBackPeriodStop = input(title = "Trade Stop Date/Time", defval = timestamp('2025-01-01T00:00:00'), group = "Trading Period Settings")

//_______ <function_declarations>
//@function       Used to calculate Simple moving average for Alligator
//@param src      Sourse for smma Calculations
//@param length   Number of bars to calculate smma
//@returns        The calculated smma value 
smma(src, length) =>
    smma =  0.0
    smma := na(smma[1]) ? ta.sma(src, length) : (smma[1] * (length - 1) + src) / length
    smma


//@function       Used to decide if current candle above the Alligator
//@param jaw      Jaw line of an Alligator
//@param teeth    Teeth line of an Alligator
//@param lips     Lips line of an Alligator
//@returns        Bool value  
is_LowAboveAlligator(jaw, teeth, lips) =>
    result = low > jaw and low > lips and low > teeth 
    result


//@function       Used to decide if current candle below the Alligator
//@param jaw      Jaw line of an Alligator
//@param teeth    Teeth line of an Alligator
//@param lips     Lips line of an Alligator
//@returns        Bool value  
is_HighBelowAlligator(jaw, teeth, lips) =>
    result = high < jaw and high < lips and high < teeth 
    result


//@function       Used to decide if Alligator's mouth is open
//@param jaw      Jaw line of an Alligator
//@param teeth    Teeth line of an Alligator
//@param lips     Lips line of an Alligator
//@returns        Bool value 
is_AlligatorHungry(jaw, teeth, lips) =>
    result = lips > jaw[5] and lips > teeth[2] and teeth > jaw[3]
    result


//_______ <calculations>
jaw = smma(hl2, 13)[8]
teeth = smma(hl2, 8)[5]
lips = smma(hl2, 5)[3]


jaw_o = smma(hl2, 13)
teeth_o = smma(hl2, 8)
lips_o = smma(hl2, 5)


//_______ <strategy_calls>
longCondition = is_LowAboveAlligator(jaw, teeth, lips) and is_AlligatorHungry(jaw_o, teeth_o, lips_o) 
if (longCondition)
    strategy.entry(id = "entry1", direction = strategy.long, alert_message = '{\n"base": "' + syminfo.basecurrency + '",\n"quote": "' + syminfo.currency + '",\n"position": "entry1",\n"price": "' + str.tostring(close) + '",\n"sourceUuid": "' + sourceUuid + '",\n"secretToken": "' + secretToken + '",\n"timestamp": "' + str.tostring(timenow) + '"\n}')

if close < jaw
    strategy.close(id = "entry1", alert_message = '{\n"base": "' + syminfo.basecurrency + '",\n"quote": "' + syminfo.currency + '",\n"position": "close",\n"price": "' + str.tostring(close) + '",\n"sourceUuid": "' + sourceUuid + '",\n"secretToken": "' + secretToken + '",\n"timestamp": "' + str.tostring(timenow) + '"\n}')



//_______ <visuals>
if strategy.opentrades > 0
    barcolor := skyrexGreen
else 
    barcolor := skyrexGray

barcolor(barcolor)
//_______ <alerts>