OPEN-SOURCE SCRIPT
My script

//version=6
strategy("Elite Option Signal Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// === INPUTS ===
fastLength = input.int(9, title="Fast MA Length")
slowLength = input.int(21, title="Slow MA Length")
trendLength = input.int(50, title="Trend MA Length")
rsiLength = input.int(14, title="RSI Length")
rsiOversold = input.int(30, title="RSI Oversold Level")
rsiOverbought = input.int(70, title="RSI Overbought Level")
useStopLoss = input.bool(true, title="Use Stop Loss?")
stopLossPercent = input.float(2.0, title="Stop Loss %", minval=0.1, maxval=10.0)
// === INDICATORS ===
fastMA = ta.sma(close, fastLength)
slowMA = ta.sma(close, slowLength)
trendMA = ta.sma(close, trendLength)
rsi = ta.rsi(close, rsiLength)
// === CONDITIONS ===
bullishTrend = close > trendMA
bearishTrend = close < trendMA
longCondition = ta.crossover(fastMA, slowMA) and bullishTrend and rsi < rsiOverbought
shortCondition = ta.crossunder(fastMA, slowMA) and bearishTrend and rsi > rsiOversold
// === EXECUTION ===
if longCondition
strategy.entry("Long", strategy.long)
if useStopLoss
strategy.exit("Exit Long", "Long", stop=close * (1 - stopLossPercent / 100))
if shortCondition
strategy.entry("Short", strategy.short)
if useStopLoss
strategy.exit("Exit Short", "Short", stop=close * (1 + stopLossPercent / 100))
// === PLOTS ===
plot(fastMA, color=color.green, title="Fast MA")
plot(slowMA, color=color.red, title="Slow MA")
plot(trendMA, color=color.blue, title="Trend MA")
plotshape(longCondition, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.triangleup)
plotshape(shortCondition, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.triangledown)
strategy("Elite Option Signal Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// === INPUTS ===
fastLength = input.int(9, title="Fast MA Length")
slowLength = input.int(21, title="Slow MA Length")
trendLength = input.int(50, title="Trend MA Length")
rsiLength = input.int(14, title="RSI Length")
rsiOversold = input.int(30, title="RSI Oversold Level")
rsiOverbought = input.int(70, title="RSI Overbought Level")
useStopLoss = input.bool(true, title="Use Stop Loss?")
stopLossPercent = input.float(2.0, title="Stop Loss %", minval=0.1, maxval=10.0)
// === INDICATORS ===
fastMA = ta.sma(close, fastLength)
slowMA = ta.sma(close, slowLength)
trendMA = ta.sma(close, trendLength)
rsi = ta.rsi(close, rsiLength)
// === CONDITIONS ===
bullishTrend = close > trendMA
bearishTrend = close < trendMA
longCondition = ta.crossover(fastMA, slowMA) and bullishTrend and rsi < rsiOverbought
shortCondition = ta.crossunder(fastMA, slowMA) and bearishTrend and rsi > rsiOversold
// === EXECUTION ===
if longCondition
strategy.entry("Long", strategy.long)
if useStopLoss
strategy.exit("Exit Long", "Long", stop=close * (1 - stopLossPercent / 100))
if shortCondition
strategy.entry("Short", strategy.short)
if useStopLoss
strategy.exit("Exit Short", "Short", stop=close * (1 + stopLossPercent / 100))
// === PLOTS ===
plot(fastMA, color=color.green, title="Fast MA")
plot(slowMA, color=color.red, title="Slow MA")
plot(trendMA, color=color.blue, title="Trend MA")
plotshape(longCondition, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.triangleup)
plotshape(shortCondition, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.triangledown)
Скрипт с открытым кодом
В истинном духе TradingView автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения.
Отказ от ответственности
Все виды контента, которые вы можете увидеть на TradingView, не являются финансовыми, инвестиционными, торговыми или любыми другими рекомендациями. Мы не предоставляем советы по покупке и продаже активов. Подробнее — в Условиях использования TradingView.
Скрипт с открытым кодом
В истинном духе TradingView автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения.
Отказ от ответственности
Все виды контента, которые вы можете увидеть на TradingView, не являются финансовыми, инвестиционными, торговыми или любыми другими рекомендациями. Мы не предоставляем советы по покупке и продаже активов. Подробнее — в Условиях использования TradingView.