平均足ROCパーセンタイルに基づく取引戦略


作成日: 2023-10-23 15:41:40 最終変更日: 2023-10-23 15:41:40
コピー: 0 クリック数: 842
1
フォロー
1617
フォロワー

平均足ROCパーセンタイルに基づく取引戦略

概要

この策略は,Heikin Ashi ROCの百分位をベースにした取引策略という名前で,Heikin Ashi ROCとその百分位をベースにした使いやすい取引の枠組みを提供することを目的としている.

戦略原則

この策略は,Heikin Ashiの収束価格のROCと,その異なる時間帯における最高値と最低値を計算することによって,取引のための上下軌道を生成する.具体的には,rocLength周期の過去のHeikin Ashiの収束価格のROCを計算する.そして,過去50周期のROCの最高値のrocHighと最低値のrocLowを計算する.その後,rocHighに基づいて上下軌道upperKillLineを計算し,rocLowに基づいて下軌道lowerKillLineを計算する.この2つの軌道線は,特定の百分数値を表示する.ROCが上下軌道を通るときは多;現在のROCが上下軌道を通るときは少;逆に,ROCが上下軌道を通るときは多;そして,ROCが上下軌道を通るときは空になる.

優位分析

この戦略の最大の利点は,ROC指標の強力なトレンド追跡能力を利用し,Heikin Ashiの平らな価格情報の特性を組み合わせて,トレンドの変化を効果的に識別できるという点にある.単純移動平均などの指標と比較して,ROCは価格の変化により敏捷に反応し,戦略を早期に介入できるようにする.さらに,パーセント生成を使用した上下軌道は,不必要な取引を誘発する偽突破を防ぐため,揺れを効果的にフィルターすることができる.全体的に,この戦略は,トレンド追跡と揺れフィルターの2つの機能を組み合わせて,トレンドの下でのより良いリスク・リターン比を得ることができる.

リスク分析

この戦略の主なリスクは,パラメータの設定が不適切であることが取引の頻度または不十分な感性を引き起こす可能性があるということです.rocLengthとパーセントの計算の周期は慎重に設定する必要があります.そうでなければ,上下があまりにも弱くまたは硬くなり,取引の機会を逃したり,不必要な損失を招く可能性があります.さらに,パーセントの設定は,異なる市場の繰り返しテストによって最適のパラメータの組み合わせを見つけるために調整する必要があります.トレンドが逆転すると,この戦略は,トレンド指標に依存しているため,一定の損失に直面します.

最適化の方向

この戦略は,以下のいくつかの点で最適化できます: 1) RSIなどの入場シグナルをフィルターする他の指標と組み合わせる; 2) 機械学習方法を利用した動的最適化パラメータ; 3) ストップダストの自動原始粗退出メカニズムを設定する; 4) 戦略のリスクをバランスするために,他の非トレンド戦略と組み合わせる.

要約する

概要として,この戦略は,ROC指標の強力なトレンド追跡能力を利用し,Heikin Ashiの特性を活用して,トレンド判断とトレンド追跡を行い,ROCパーセントの形成による上下トラックのストップダストフィルタリングを行います. 優れたトレンド追跡効果を示している.その優点は,トレンドの変化を早期に認識し,大きなトレンドを追跡し,上下線フィルターによる振動である.しかし,パラメータを正しく設定しないことは,戦略のパフォーマンスに影響を与え,トレンドの逆転のリスクに直面している.パラメータの選択をさらに最適化し,ストップとストップを設定することで,この戦略はより安定した効果を得ることができる.

ストラテジーソースコード
/*backtest
start: 2023-09-22 00:00:00
end: 2023-10-22 00:00:00
period: 1h
basePeriod: 15m
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/
// © jensenvilhelm

//@version=5
strategy("Heikin Ashi ROC Percentile Strategy", shorttitle="ROC ON" , overlay=false)

// User Inputs
zerohLine = input(0, title="Midline")  // Zero line, baseline for ROC (customer can modify this to adjust midline)
rocLength = input(100, title="roc Length")  // Lookback period for SMA and ROC (customer can modify this to adjust lookback period)

stopLossLevel = input(2, title="Stop Loss (%)")  // Level at which the strategy stops the loss (customer can modify this to adjust stop loss level)
startDate = timestamp("2015 03 03")  // Start date for the strategy (customer can modify this to adjust start date)

// Heikin Ashi values
var float haClose = na  // Define Heikin Ashi close price
var float haOpen = na  // Define Heikin Ashi open price
haClose := ohlc4  // Calculate Heikin Ashi close price as average of OHLC4 (no customer modification needed here)
haOpen := na(haOpen[1]) ? (open + close) / 2 : (haOpen[1] + haClose[1]) / 2  // Calculate Heikin Ashi open price (no customer modification needed here)

// ROC Calculation
roc = ta.roc(ta.sma(haClose, rocLength), rocLength)  // Calculate Rate of Change (ROC) (customer can modify rocLength in the inputs)
rocHigh = ta.highest(roc, 50)  // Get the highest ROC of the last 50 periods (customer can modify this to adjust lookback period)
rocLow = ta.lowest(roc, 50)  // Get the lowest ROC of the last 50 periods (customer can modify this to adjust lookback period)
upperKillLine = ta.percentile_linear_interpolation(rocHigh, 10, 75)  // Calculate upper kill line (customer can modify parameters to adjust this line)
lowerKillLine = ta.percentile_linear_interpolation(rocLow, 10, 25)  // Calculate lower kill line (customer can modify parameters to adjust this line)

// Trade conditions
enterLong = ta.crossover(roc, lowerKillLine)  // Define when to enter long positions (customer can modify conditions to adjust entry points)
exitLong = ta.crossunder(roc, upperKillLine)  // Define when to exit long positions (customer can modify conditions to adjust exit points)
enterShort = ta.crossunder(roc, upperKillLine)  // Define when to enter short positions (customer can modify conditions to adjust entry points)
exitShort = ta.crossover(roc, lowerKillLine )  // Define when to exit short positions (customer can modify conditions to adjust exit points)

// Strategy execution
if(time >= startDate)  // Start strategy from specified start date
    if (enterLong)
        strategy.entry("Long", strategy.long)  // Execute long trades
    if (exitLong)
        strategy.close("Long")  // Close long trades
    if (enterShort)
        strategy.entry("Short", strategy.short)  // Execute short trades
    if (exitShort)
        strategy.close("Short")  // Close short trades

// Plotting
plot(zerohLine,title="Zeroline")  // Plot zero line
plot(roc, "RSI", color=color.rgb(248, 248, 248))  // Plot ROC
plot(rocHigh, "Roc High", color = color.rgb(175, 78, 76))  // Plot highest ROC
plot(rocLow, "Roc Low", color = color.rgb(175, 78, 76))  // Plot lowest ROC
plot(upperKillLine, "Upper Kill Line", color = color.aqua)  // Plot upper kill line
plot(lowerKillLine, "Lower Kill Line", color = color.aqua)  // Plot lower kill line