
この戦略は,VIDYA (変数指数動平均) 指標に基づくトレンド追跡取引システムである.この戦略は,市場変動に適応するために,動的に調整する重みを使用して,より正確なトレンド識別と取引信号生成を実現するために,氏運動指数 (CMO) と標準差 (StDev) の2つの計算方法を組み合わせている.システムは,従来の移動平均に基づいて,自己適応機構を導入し,市場の状況に応じて自動的に感度調整することができる.
戦略の核心はVIDYA指標で,その計算過程には以下の重要なステップが含まれています.
この戦略は,ユーザがCMOまたは標準差を使用して波動率係数を計算する選択を許し,戦略の柔軟性を高めます.CMOモードでは9サイクルが固定され,標準差モードは基本周期と一致しています.
VIDYA戦略は,革新的な自己適応重量メカニズムによって,比較的信頼性の高いトレンド追跡プログラムを提供します. この戦略は,シンプルで使いやすいままにしながら,ダイナミックな調整によって,市場の変化への適応力を向上させます.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-12-04 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © GriffinJames
//@version=5
strategy("VIDYA Strategy", overlay=true, initial_capital=25000)
// Inputs
src = input(close, title="Source")
pds = input.int(21, title="Length")
fixCMO = input.bool(true, title="Fixed CMO Length (9)?")
select = input.bool(true, title="Calculation Method: CMO/StDev?")
alpha = 2 / (pds + 1)
momm = ta.change(src)
// Functions to calculate MOM
f1(m) => m >= 0.0 ? m : 0.0
f2(m) => m >= 0.0 ? 0.0 : -m
m1 = f1(momm)
m2 = f2(momm)
sm1 = fixCMO ? math.sum(m1, 9) : math.sum(m1, pds)
sm2 = fixCMO ? math.sum(m2, 9) : math.sum(m2, pds)
percent(nom, div) => 100 * nom / div
chandeMO = na(percent(sm1 - sm2, sm1 + sm2)) ? 0 : percent(sm1 - sm2, sm1 + sm2)
// Select calculation method
k = select ? math.abs(chandeMO) / 100 : ta.stdev(src, pds)
// Calculate VIDYA
var float VIDYA = na
VIDYA := na(VIDYA[1]) ? src : alpha * k * src + (1 - alpha * k) * VIDYA[1]
// Conditions for long and short
col12 = VIDYA > VIDYA[1]
col32 = VIDYA < VIDYA[1]
// Plot VIDYA with dynamic colors
color2 = col12 ? color.new(color.blue, 0) : col32 ? color.new(color.maroon, 0) : color.new(color.blue, 0)
plot(VIDYA, "VAR", color=color2, linewidth=2)
// Long and Short Strategy
if (col12)
strategy.entry("Go Long", strategy.long)
if (col32)
strategy.entry("Go Short", strategy.short)
// Alert for VIDYA color change
alertcondition(ta.cross(VIDYA, VIDYA[1]), title="Color ALARM!", message="VIDYA has changed color!")