
相対取引量比動量取引戦略は,相対取引量分析,価格行動フィルタリング,ブレイク検出,動的ストップ/ストップロジックを組み合わせた総合的な取引システムである.この戦略の核心は,相対取引量におけるウィリアムズ %Rのような指標 ((RVPR)) を計算し,双均線フィルター ((快速と遅い移動平均)) と組み合わせて,相対取引量拡大または収縮の瞬間を識別することである.この戦略は,さらに,配置可能な価格行動フィルターを使用して,異なるタイプののグラフィック状態に基づいて正確な場景条件を判断する.この戦略は,相対取引量増加との行動の反転または延期の設定に基づいてトレーダーを探し出すのに特に適しており,高度に適応した多空取引信号を提供します.
この戦略の核心原則は,取引量データをパーセントの範囲に変換し,ウィリアムズ%Rのような計算方法を使用して,現在の取引量とその歴史的範囲の関係を分析することです.この戦略は,取引信号を生成するために以下のいくつかの重要な構成要素を使用します.
相対取引量%R振動器:現在の取引量と歴史的な取引量の最高値と最低値を比較し,相対位置を計算する.この指標は価格領域のウィリアムズ %Rに類似しているが,取引量データに適用される.
双移動平均線フィルタリング:戦略は2つの取引量移動平均線 ((速いと遅い) を使用し,複数の平滑アルゴリズム ((SMA,EMA,JMA,T3,Super Smootherなど) を選択できます.取引量が急速平均線より大きく,そして急速平均線が遅い平均線より大きく,取引量の傾向が向上していることを示す場合,多信号が作られます.その逆も同様です.
価格行動フィルター: 異なるフィルタグラフ形状に基づいて取引信号をさらにフィルターします.
フィルターを突破する:リスクとリターンの差を避けるために,選択的に5つのの高点/低点近くの取引を排除する.
止損と停止システム:ATR ((平均リアル波幅) に基づくダイナミックな止損/停止機構.止損と停止の距離を調整するために倍数配置することができる.
退出時間:固定数のの後に退出する選択肢がある.
多頭入場条件は,取引量が急速移動平均より大きい,急速移動平均が遅い移動平均より大きい,相対取引量%Rが値より大きい,価格が多頭方向フィルターを通過し,最近の突破高点より選択的に低い.空頭入場条件は,逆であり,設定された退出条件で平仓を触発する.
多次元分析:この戦略は,取引量,価格行動,およびストップ/ストップの動態を組み合わせ,市場分析の包括的な枠組みを提供します.
高度カスタマイズ可能:戦略は,取引方向制御,異なる価格行動フィルタリングモード,取引量移動平均型選択など,多くのパラメータをカスタマイズすることができます.
スマートエントリーフィルター:取引量動力と価格行動パターンを組み合わせることで,戦略はより高い確率の取引機会を識別し,低品質の取引信号を回避します.
フレキシブルな退出メカニズム:戦略は,時間と価格に基づいた退出オプションを提供し,固定バー数退出とATRベースのダイナミックなストップ/ストップを備えて,リスク管理をより柔軟に効果的にします.
多様な市場環境への適応:異なる価格行動パターン (単純,フィルター,激進,内部) を介して,戦略は,トレンド市場や区間市場を含む異なる市場条件に適応することができます.
高級技術指標統合:戦略は,JMA (ジュリク移動平均),T3およびSuper Smootherなどの複数の高級移動平均タイプを統合し,これらの指標は,ノイズを軽減し,実際のトレンドを捉えるのに優れている.
パラメータ最適化リスク: 策略に複数の調整可能なパラメータが含まれているため,過度に最適化のリスクがあり,歴史回測の優れたパフォーマンスをもたらす可能性が高く,実績は低い. 解決策は,前向きなテストと粗略性分析を使用して,異なる市場条件下でパラメータが安定性を保つのである.
偽の突破のリスク:取引量突破は必ずしも常に持続的な価格動向に伴わない.戦略は偽の突破で誤ったシグナルを生じることがあります.このリスクを軽減するには,追加の確認指標を追加したり,入場を遅らせたりすることができます.
市場環境依存性:この戦略は,異なる市場環境 (例えば,高波動性vs低波動性) で不一致なパフォーマンスを示す可能性があります. 戦略を実装する前に,さまざまな市場条件でテストすることをお勧めします.
ストップをトリガーするリスク:ATRベースのストップは,突然の変動が拡大したときにトリガーされる可能性があります. 変動の調整のストップ倍数を使用するか,重要なサポート/レジスタンス位置にストップを設定することを考慮することがより有効かもしれません.
退出のタイミングは柔軟ではない:固定棒数退出は,利益のある取引を早めに終了したり,損失のある取引を遅れて終了したりする可能性がある. 退出のタイミングを動的に調整するために,トレンドまたは動態指標と組み合わせて考慮することができます.
計算の複雑さ: 策略は,複数の複雑な移動平均アルゴリズムと条件の組み合わせを使用しており,計算の負担を増加させ,実行の遅延を引き起こす可能性があります.リアルタイム取引では,一部の計算密度の高い指標を簡素化する必要がある可能性があります.
動的値調整:現在の戦略は,固定された相対取引量%Rの値 ((27) を使用し,最近の取引量変動に基づいて自主調整の値を実現することを考慮することができます.これは,戦略を異なる市場条件と季節的な変化により良く適応させるでしょう.
多時間枠確認:より高い時間枠の確認シグナルを導入し,より大きなトレンド方向のみで取引することで,戦略の勝率とリスク報酬率を高めることができます.例えば,当日の日線が上昇する時にのみ,時間線上の多頭シグナルを実行します.
交付量質分析:相対交付量に加えて,交付量拡散指数または交付量分布分析を添加して,交付量の質を単に数量ではなく評価することができる.これは,健康的な傾向を確認した交付量と潜在的に枯渇した信号を区別するのに役立ちます.
インテリジェント・ストップ/ストップ:現在のATRの基礎のストップ/ストップは,よりインテリジェントなシステムに改良することができる.例えば,重要なサポート/レジスタンス位置に基づいて,または波動性調整のストップを使用して,低波動期にストップを締め,高波動期にストップを緩める.
市場構造を統合する: 戦略に価格構造分析 (支持/抵抗,トレンドライン,価格チャネルなど) を統合することで,エントリーポイントとエグジットポイントの質を向上させることができます.
リスク管理の強化:現在の市場変動と最近の戦略のパフォーマンスをベースに,ポジションの動的なサイズ調整を実現し,高い勝率の環境でポジションを増やし,不確実な期間にポジションを減らす.
機械学習統合: 戦略パラメータを動的に最適化するために機械学習アルゴリズムを使用するか,現在の市場条件でどの価格行動フィルターが最も有効かを予測することで,戦略のパフォーマンスをさらに向上させることができます.
相対取引量比動量取引戦略は,取引量分析,複数の価格行動フィルター,およびダイナミックリスク管理技術を組み合わせた包括的で柔軟な取引システムであり,潜在的な市場機会を識別するための強力なツールを提供します. この戦略の核心的な優点は,その適応性とカスタマイズ性であり,個人好みや市場条件に応じて調整することを可能にします.
この戦略は,取引量の確認に基づく反転またはトレンド継続のシグナルを探しているトレーダーに特に適しています. ウィリアムズ%Rスタイルの相対取引量指標を使用して,この戦略は,通常,市場情緒の重要な転換またはトレンドの加速を表す取引量急増点を識別できます. 同時に,複数の価格行動フィルターオプションは,トレーダーに,自分のリスクの好みと取引スタイルに応じて,より保守的なまたはより激進的な入場条件を選択できるようにします.
この戦略は多くの利点を提供しているものの,トレーダーは,潜在的過剰最適化リスクと市場環境依存性に注意する必要があります.継続的にテストし,調整し,推奨された最適化方向と組み合わせることで,トレーダーは,この戦略の安定性と長期的な収益性をさらに高めることができます.最終的には,すべての取引戦略と同様に,成功の鍵は,その原理を深く理解し,リスクを賢く管理し,異なる市場条件下でそのパフォーマンスを継続的に評価することです.
/*backtest
start: 2024-07-04 00:00:00
end: 2025-07-02 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"ETH_USDT"}]
*/
// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © GabrielAmadeusLau
//@version=6
strategy("Relative Volume Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
// === Input: Trade Direction === //
tradeDirection = input.string("Long Only", title="Trade Direction", options=["Long Only", "Short Only", "Both"], group="Strategy Settings")
dirBarModeL = input.string("Simple", title="Long Directional Bar Mode", options=["Simple", "Filtered", "Aggressive", "Inside", "Filtered & Aggressive", "Filtered & Aggressive & Inside", "Without"], group="Strategy Settings")
dirBarModeS = input.string("Inside", title="Short Directional Bar Mode", options=["Simple", "Filtered", "Aggressive", "Inside", "Filtered & Aggressive", "Filtered & Aggressive & Inside", "Without"], group="Strategy Settings")
useBreakout = input.bool(true, "Use Breakout Filter", group="Strategy Settings")
useSLTP = input.bool(false, "Use Stop Loss & Take Profit", group="Strategy Settings")
atrSLMult = input.float(1, "ATR SL Multiplier", step = 0.05, group="Strategy Settings")
atrTPMult = input.float(1.75, "ATR TP Multiplier", step = 0.05, group="Strategy Settings")
// === Input: MA Function Selector === //
// — T3 Moving Average Function —
// src = input source (e.g. rsi1, close, etc.)
// length = smoothing length (period)
// a = T3 alpha (commonly between 0.7 and 0.9)
t3(src, length, a) =>
e1 = ta.ema(src, length)
e2 = ta.ema(e1, length)
e3 = ta.ema(e2, length)
e4 = ta.ema(e3, length)
e5 = ta.ema(e4, length)
e6 = ta.ema(e5, length)
c1 = -a * a * a
c2 = 3 * a * a + 3 * a * a * a
c3 = -6 * a * a - 3 * a - 3 * a * a * a
c4 = 1 + 3 * a + a * a * a + 3 * a * a
c1 * e6 + c2 * e5 + c3 * e4 + c4 * e3
// == Jurik MA == //
jma(float src, int length, float power, float phase) =>
phaseRatio = phase < -100 ? 0.5 : phase > 100 ? 2.5 : phase / 100 + 1.5
beta = 0.45 * (length - 1) / (0.45 * (length - 1) + 2)
alpha = math.pow(beta, power)
JMA = 0.0
e0 = 0.0
e0 := (1 - alpha) * src + alpha * nz(e0[1])
e1 = 0.0
e1 := (src - e0) * (1 - beta) + beta * nz(e1[1])
e2 = 0.0
e2 := (e0 + phaseRatio * e1 - nz(JMA[1])) * math.pow(1 - alpha, 2) + math.pow(alpha, 2) * nz(e2[1])
JMA := e2 + nz(JMA[1])
//===== 2 Pole Super Smoother Filter =====//
superSmoother(float Series, float Period) =>
var float ALPHA = math.pi * math.sqrt(2.0) / Period
var float BETA = math.exp(-ALPHA )
var float COEF2 = -math.pow(BETA, 2)
var float COEF1 = math.cos( ALPHA ) * 2.0 * BETA
var float COEF0 = 1.0 - COEF1 - COEF2
float sma2 = math.avg(Series, nz(Series[1], Series))
float smooth = na, smooth := COEF0 * sma2 +
COEF1 * nz(smooth[1]) +
COEF2 * nz(smooth[2])
// === MA Selector === //
ma(source, length, type) =>
type == "SMA" ? ta.sma(source, length) :
type == "EMA" ? ta.ema(source, length) :
type == "SMMA (RMA)"? ta.rma(source, length) :
type == "WMA" ? ta.wma(source, length) :
type == "VWMA" ? ta.vwma(source, length) :
type == "HMA" ? ta.hma(source, length) :
type == "ALMA" ? ta.alma(source, length, 0.85, 6) :
type == "LSMA" ? ta.linreg(source, length, 0) :
type == "Optimal MA"? math.avg(ta.alma(source, length, 0.85, 6), ta.rma(source, length), ta.sma(source, length)) :
type == "JMA" ? jma(source, length, 2, 50) :
type == "Super Smoother" ? superSmoother(source, length) :
type == "T3" ? t3(source, length, 0.7) :
na
// === Input Parameters === //
rvolRLength = input.int(112, title="Relative Volume %R Length", minval=1, group="Relative Volume", tooltip="%R used for scaling from 0 to 100, I prefer 73 or 112.")
rvolmaTypeInput = input.string("Optimal MA" , "Type", options = ["None", "SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA", "HMA", "ALMA", "LSMA", "Optimal MA", "JMA", "Super Smoother", "T3"], group = "Relative Volume")
rvolFastLength = input.int(7, title="Relative Volume Fast MA", minval=1, group="Relative Volume")
rvolSlowLength = input.int(161, title="Relative Volume Slow MA", minval=1, group="Relative Volume")
exitBars = input.int(18, title="Bars Until Exit", group="Strategy Settings", tooltip="Exit trade after N bars")
rvolThreshold = input.int(27, "Minimum Relative Volume %R Threshold", group="Relative Volume")
// === Williams %R for Volume === //
wpr(src, length) =>
max_ = ta.highest(src, length)
min_ = ta.lowest(src, length)
(100 * (src - max_) / (max_ - min_)) * -1
// === Volume MAs === //
rvol = wpr(volume, rvolRLength)
rvolFast = ma(volume, rvolFastLength, rvolmaTypeInput)
rvolSlow = ma(volume, rvolSlowLength, rvolmaTypeInput)
// === Price Action Filters === //
up = close > open
upRange = low > low[1] and close > high[1]
upRange_Aggr = close > close[1] and close > open[1]
insideDayUp = close < close[1] and close[1] < close[2] and close[2] < close[3] and close[3] < close[4] and close[4] < close[5] //and not (close > close[1])
down = close < open
downRange = high < high[1] and close < low[1]
downRange_Aggr= close < close[1] and close < open[1]
insideDayDown = close > close[1] and close[1] > close[2] and close[2] > close[3] and close[3] > close[4] and close[4] > close[5] //and not (close < close[1])
breakoutHigh = ta.highest(high, 5)
breakoutLow = ta.lowest(low, 5)
// === Mode-Based Filter Logic === //
longBarOK =
dirBarModeL == "Simple" ? up :
dirBarModeL == "Filtered" ? upRange :
dirBarModeL == "Aggressive"? upRange_Aggr :
dirBarModeL == "Inside"? insideDayUp :
dirBarModeL == "Filtered & Aggressive" ? upRange or upRange_Aggr :
dirBarModeL == "Filtered & Aggressive & Inside" ? upRange or upRange_Aggr or insideDayUp :
dirBarModeL == "Without" ? true : false
shortBarOK =
dirBarModeS == "Simple" ? down :
dirBarModeS == "Filtered" ? downRange :
dirBarModeS == "Aggressive"? downRange_Aggr :
dirBarModeS == "Inside"? insideDayDown :
dirBarModeS == "Filtered & Aggressive"? downRange or downRange_Aggr or insideDayDown :
dirBarModeS == "Filtered & Aggressive & Inside"? upRange_Aggr or insideDayDown :
dirBarModeS == "Without" ? true : false
// === Entry & Exit Logic === //
longCondition = volume > rvolFast and rvolFast > rvolSlow and longBarOK and rvol > rvolThreshold and (not useBreakout or close < breakoutHigh)
shortCondition = volume < rvolFast and rvolFast < rvolSlow and shortBarOK and rvol < (100 - rvolThreshold) and (not useBreakout or close > breakoutLow)
exitLongCondition = strategy.opentrades > 0 and strategy.opentrades.entry_bar_index(0) + exitBars <= bar_index and strategy.opentrades.entry_id(0) == "Long"
exitShortCondition = strategy.opentrades > 0 and strategy.opentrades.entry_bar_index(0) + exitBars <= bar_index and strategy.opentrades.entry_id(0) == "Short"
atr = ta.atr(math.round(math.avg(rvolFastLength, rvolSlowLength)))
longSL = useSLTP ? close - atrSLMult * atr : na
longTP = useSLTP ? close + atrTPMult * atr : na
shortSL = useSLTP ? close + atrSLMult * atr : na
shortTP = useSLTP ? close - atrTPMult * atr : na
// === Strategy Execution === //
if (tradeDirection == "Long Only" or tradeDirection == "Both")
if (longCondition)
strategy.entry("Long", strategy.long, stop=longSL, limit=longTP)
if (tradeDirection == "Short Only" or tradeDirection == "Both")
if (shortCondition)
strategy.entry("Short", strategy.short, stop=shortSL, limit=shortTP)
if (exitLongCondition)
strategy.close("Long")
if (exitShortCondition)
strategy.close("Short")
// === Plotting === //
plot(rvol, title="Relative Volume %R", color=color.orange, style = plot.style_columns, format = format.price)
plot(rvolFast, title="Fast Volume MA", color=color.green, format = format.volume)
plot(rvolSlow, title="Slow Volume MA", color=color.red, format = format.volume)