OPEN-SOURCE SCRIPT
Valtoro Adaptive Momentum

//version=5
strategy("Valtoro Adaptive Momentum", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
// === Inputs ===
lengthFast = input.int(14, title="Fast EMA")
lengthSlow = input.int(28, title="Slow EMA")
rsiPeriod = input.int(14, title="RSI Period")
atrPeriod = input.int(14, title="ATR Period")
riskMultiplier = input.float(1.5, title="Volatility Threshold Multiplier", step=0.1)
rsiOB = input.int(70, title="RSI Overbought")
rsiOS = input.int(30, title="RSI Oversold")
// === Indicators ===
fastEMA = ta.ema(close, lengthFast)
slowEMA = ta.ema(close, lengthSlow)
rsi = ta.rsi(close, rsiPeriod)
atr = ta.atr(atrPeriod)
avgATR = ta.sma(atr, atrPeriod)
// === Conditions ===
longCond = ta.crossover(fastEMA, slowEMA) and rsi < rsiOB and atr > avgATR * riskMultiplier
shortCond = ta.crossunder(fastEMA, slowEMA) and rsi > rsiOS and atr > avgATR * riskMultiplier
// === Risk Management ===
longSL = close * 0.98 // 2% Stop Loss
longTP = close * 1.05 // 5% Take Profit
shortSL = close * 1.02
shortTP = close * 0.95
// === Strategy Entries and Exits ===
if (longCond)
strategy.entry("Long", strategy.long)
strategy.exit("Exit Long", from_entry="Long", stop=longSL, limit=longTP)
if (shortCond)
strategy.entry("Short", strategy.short)
strategy.exit("Exit Short", from_entry="Short", stop=shortSL, limit=shortTP)
// === Visuals ===
plot(fastEMA, title="Fast EMA", color=color.blue)
plot(slowEMA, title="Slow EMA", color=color.red)
hline(rsiOB, "RSI Overbought", color=color.red)
hline(rsiOS, "RSI Oversold", color=color.green)
strategy("Valtoro Adaptive Momentum", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
// === Inputs ===
lengthFast = input.int(14, title="Fast EMA")
lengthSlow = input.int(28, title="Slow EMA")
rsiPeriod = input.int(14, title="RSI Period")
atrPeriod = input.int(14, title="ATR Period")
riskMultiplier = input.float(1.5, title="Volatility Threshold Multiplier", step=0.1)
rsiOB = input.int(70, title="RSI Overbought")
rsiOS = input.int(30, title="RSI Oversold")
// === Indicators ===
fastEMA = ta.ema(close, lengthFast)
slowEMA = ta.ema(close, lengthSlow)
rsi = ta.rsi(close, rsiPeriod)
atr = ta.atr(atrPeriod)
avgATR = ta.sma(atr, atrPeriod)
// === Conditions ===
longCond = ta.crossover(fastEMA, slowEMA) and rsi < rsiOB and atr > avgATR * riskMultiplier
shortCond = ta.crossunder(fastEMA, slowEMA) and rsi > rsiOS and atr > avgATR * riskMultiplier
// === Risk Management ===
longSL = close * 0.98 // 2% Stop Loss
longTP = close * 1.05 // 5% Take Profit
shortSL = close * 1.02
shortTP = close * 0.95
// === Strategy Entries and Exits ===
if (longCond)
strategy.entry("Long", strategy.long)
strategy.exit("Exit Long", from_entry="Long", stop=longSL, limit=longTP)
if (shortCond)
strategy.entry("Short", strategy.short)
strategy.exit("Exit Short", from_entry="Short", stop=shortSL, limit=shortTP)
// === Visuals ===
plot(fastEMA, title="Fast EMA", color=color.blue)
plot(slowEMA, title="Slow EMA", color=color.red)
hline(rsiOB, "RSI Overbought", color=color.red)
hline(rsiOS, "RSI Oversold", color=color.green)
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuna uygun olarak, bu komut dosyasının oluşturucusu bunu açık kaynaklı hale getirmiştir, böylece yatırımcılar betiğin işlevselliğini inceleyip doğrulayabilir. Yazara saygı! Ücretsiz olarak kullanabilirsiniz, ancak kodu yeniden yayınlamanın Site Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuna uygun olarak, bu komut dosyasının oluşturucusu bunu açık kaynaklı hale getirmiştir, böylece yatırımcılar betiğin işlevselliğini inceleyip doğrulayabilir. Yazara saygı! Ücretsiz olarak kullanabilirsiniz, ancak kodu yeniden yayınlamanın Site Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.