OPEN-SOURCE SCRIPT
скрипт чат gpt

//version=5
indicator("Swing+DCA Strategy", overlay=true, max_labels_count=500)
// ===== EMA =====
ema7 = ta.ema(close, 7)
ema26 = ta.ema(close, 26)
ema200 = ta.ema(close, 200)
plot(ema7, color=color.yellow, linewidth=1, title="EMA 7")
plot(ema26, color=color.red, linewidth=1, title="EMA 26")
plot(ema200, color=color.white, linewidth=1, title="EMA 200")
// ===== MACD =====
fastLength = 8
slowLength = 24
signalLength = 9
macdValue = ta.ema(close, fastLength) - ta.ema(close, slowLength)
macdSignal = ta.ema(macdValue, signalLength)
macdHist = macdValue - macdSignal
// MACD визуализация в отдельном окне
macdColor = macdHist >= 0 ? color.green : color.red
plot(macdValue, color=color.new(color.blue, 0), title="MACD Line", display=display.none)
plot(macdSignal, color=color.new(color.orange, 0), title="MACD Signal", display=display.none)
plot(macdHist, style=plot.style_columns, color=macdColor, title="MACD Histogram", display=display.none)
// ===== RSI =====
rsi = ta.rsi(close, 14)
hline(70, 'RSI Overbought', color=color.red)
hline(50, 'RSI Midline', color=color.gray)
hline(30, 'RSI Oversold', color=color.green)
// ===== Supertrend =====
atrPeriod = 10
factor = 3.0
[supertrend, direction] = ta.supertrend(factor, atrPeriod)
plot(supertrend, color=direction < 0 ? color.red : color.green, title="Supertrend")
// ===== ADX =====
adx = ta.adx(14)
plotchar(adx > 20, char="▲", location=location.bottom, color=color.green, size=size.tiny, title="ADX>20")
// ===== Pivot Points Classic =====
pivotType = input.string("Classic", "Pivot Type", options=["Classic", "Fibonacci", "Woodie", "Camarilla"])
piv = request.security(syminfo.tickerid, "D", ta.pivothigh(high, 3, 3))
plotshape(piv, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.tiny, title="Pivot High")
pivl = request.security(syminfo.tickerid, "D", ta.pivotlow(low, 3, 3))
plotshape(pivl, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.tiny, title="Pivot Low")
// ===== Smart DCA (условная подсветка) =====
buyZone = rsi < 35 and close < ema200
bgcolor(buyZone ? color.new(color.green, 85) : na, title="Smart DCA Zone")
// ===== Alerts =====
longSignal = ta.crossover(ema7, ema26) and macdValue > macdSignal and rsi > 50 and adx > 20
shortSignal = ta.crossunder(ema7, ema26) and macdValue < macdSignal and rsi < 50 and adx > 20
plotshape(longSignal, title="Buy Signal", style=shape.labelup, color=color.green, text="BUY", size=size.small, location=location.belowbar)
plotshape(shortSignal, title="Sell Signal", style=shape.labeldown, color=color.red, text="SELL", size=size.small, location=location.abovebar)
alertcondition(longSignal, title="Buy Alert", message="Swing+DCA: BUY signal!")
alertcondition(shortSignal, title="Sell Alert", message="Swing+DCA: SELL signal!")
indicator("Swing+DCA Strategy", overlay=true, max_labels_count=500)
// ===== EMA =====
ema7 = ta.ema(close, 7)
ema26 = ta.ema(close, 26)
ema200 = ta.ema(close, 200)
plot(ema7, color=color.yellow, linewidth=1, title="EMA 7")
plot(ema26, color=color.red, linewidth=1, title="EMA 26")
plot(ema200, color=color.white, linewidth=1, title="EMA 200")
// ===== MACD =====
fastLength = 8
slowLength = 24
signalLength = 9
macdValue = ta.ema(close, fastLength) - ta.ema(close, slowLength)
macdSignal = ta.ema(macdValue, signalLength)
macdHist = macdValue - macdSignal
// MACD визуализация в отдельном окне
macdColor = macdHist >= 0 ? color.green : color.red
plot(macdValue, color=color.new(color.blue, 0), title="MACD Line", display=display.none)
plot(macdSignal, color=color.new(color.orange, 0), title="MACD Signal", display=display.none)
plot(macdHist, style=plot.style_columns, color=macdColor, title="MACD Histogram", display=display.none)
// ===== RSI =====
rsi = ta.rsi(close, 14)
hline(70, 'RSI Overbought', color=color.red)
hline(50, 'RSI Midline', color=color.gray)
hline(30, 'RSI Oversold', color=color.green)
// ===== Supertrend =====
atrPeriod = 10
factor = 3.0
[supertrend, direction] = ta.supertrend(factor, atrPeriod)
plot(supertrend, color=direction < 0 ? color.red : color.green, title="Supertrend")
// ===== ADX =====
adx = ta.adx(14)
plotchar(adx > 20, char="▲", location=location.bottom, color=color.green, size=size.tiny, title="ADX>20")
// ===== Pivot Points Classic =====
pivotType = input.string("Classic", "Pivot Type", options=["Classic", "Fibonacci", "Woodie", "Camarilla"])
piv = request.security(syminfo.tickerid, "D", ta.pivothigh(high, 3, 3))
plotshape(piv, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.tiny, title="Pivot High")
pivl = request.security(syminfo.tickerid, "D", ta.pivotlow(low, 3, 3))
plotshape(pivl, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.tiny, title="Pivot Low")
// ===== Smart DCA (условная подсветка) =====
buyZone = rsi < 35 and close < ema200
bgcolor(buyZone ? color.new(color.green, 85) : na, title="Smart DCA Zone")
// ===== Alerts =====
longSignal = ta.crossover(ema7, ema26) and macdValue > macdSignal and rsi > 50 and adx > 20
shortSignal = ta.crossunder(ema7, ema26) and macdValue < macdSignal and rsi < 50 and adx > 20
plotshape(longSignal, title="Buy Signal", style=shape.labelup, color=color.green, text="BUY", size=size.small, location=location.belowbar)
plotshape(shortSignal, title="Sell Signal", style=shape.labeldown, color=color.red, text="SELL", size=size.small, location=location.abovebar)
alertcondition(longSignal, title="Buy Alert", message="Swing+DCA: BUY signal!")
alertcondition(shortSignal, title="Sell Alert", message="Swing+DCA: SELL signal!")
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.