OPEN-SOURCE SCRIPT

5분봉 레버리지 20배 자동매매 전략 (최종)

//version=5
indicator("5분봉 레버리지 20배 자동매매 전략 (최종)", overlay=true)

// === PARAMETERS ===
// RSI
rsiPeriod = input.int(14, title="RSI Period", minval=1)
overbought = input.float(70.0, title="RSI Overbought Level", step=0.1)
oversold = input.float(30.0, title="RSI Oversold Level", step=0.1)

// 이동평균선
smaShort = input.int(50, title="Short SMA Length", minval=1)
smaLong = input.int(200, title="Long SMA Length", minval=1)

// 리스크 관리
takeProfit = input.float(3.0, title="Take Profit %", step=0.1)
stopLoss = input.float(1.0, title="Stop Loss %", step=0.1)

// === INDICATORS ===
// RSI
rsiValue = ta.rsi(close, rsiPeriod)

// 이동평균선
smaShortValue = ta.sma(close, smaShort)
smaLongValue = ta.sma(close, smaLong)

// MACD
[macdLine, signalLine, _] = ta.macd(close, 12, 26, 9)

// 볼린저 밴드
[upperBB, middleBB, lowerBB] = ta.bb(close, 20, 2)

// 프랙탈
bullishFractal = ta.pivotlow(low, 2, 2) // 하락 프랙탈
bearishFractal = ta.pivothigh(high, 2, 2) // 상승 프랙탈

// 엘리어트 파동 (간단한 패턴 분석)
wave1 = (rsiValue < oversold) and (smaShortValue > smaLongValue) and (macdLine > signalLine)
wave3 = (rsiValue > oversold) and (macdLine > signalLine) and (close > upperBB)
wave5 = (rsiValue > 70) and (macdLine < signalLine) and (close > smaLongValue)
waveA = (rsiValue > overbought) and (macdLine < signalLine) and (close < smaShortValue)
waveC = (rsiValue < 30) and (macdLine > signalLine) and (close < lowerBB)

// === LONG ENTRY CONDITION ===
longCondition = (rsiValue < oversold) and (smaShortValue > smaLongValue) and (macdLine > signalLine) and (close <= lowerBB) and not na(bullishFractal) and (wave1 or wave5)

// === SHORT ENTRY CONDITION ===
shortCondition = (rsiValue > overbought) and (smaShortValue < smaLongValue) and (macdLine < signalLine) and (close >= upperBB) and not na(bearishFractal) and (waveA or waveC)

// === ALERTS ===
if (longCondition)
alert("LONG_SIGNAL", alert.freq_once_per_bar)

if (shortCondition)
alert("SHORT_SIGNAL", alert.freq_once_per_bar)

// === VISUAL INDICATORS ===
// 이동평균선
plot(smaShortValue, title="SMA 50", color=color.blue)
plot(smaLongValue, title="SMA 200", color=color.red)

// 볼린저 밴드
plot(upperBB, title="Upper BB", color=color.green)
plot(lowerBB, title="Lower BB", color=color.red)

// RSI 레벨
hline(overbought, "RSI Overbought", color=color.red)
hline(oversold, "RSI Oversold", color=color.green)
plot(rsiValue, title="RSI", color=color.purple)

// 프랙탈 표시
plotshape(not na(bullishFractal), title="Bullish Fractal", style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small, text="Bull")
plotshape(not na(bearishFractal), title="Bearish Fractal", style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small, text="Bear")

// ENTRY POINT 표시
var float lastLongEntry = na
var float lastShortEntry = na

if (longCondition)
lastLongEntry := close
if (shortCondition)
lastShortEntry := close

plotshape(not na(lastLongEntry), title="Long Entry Point", style=shape.labelup, location=location.belowbar, color=color.green, text="LONG")
plotshape(not na(lastShortEntry), title="Short Entry Point", style=shape.labeldown, location=location.abovebar, color=color.red, text="SHORT")
Bill Williams IndicatorsBreadth IndicatorsMoving Averages

Açık kaynak kodlu komut dosyası

Gerçek TradingView ruhuna uygun olarak, bu komut dosyasının yazarı komut dosyasını açık kaynak olarak yayınlamıştır, böylece yatırımcılar betiği anlayabilir ve doğrulayabilir. Yazar çok yaşa! Ücretsiz olarak kullanabilirsiniz, ancak bu kodun yayında yeniden kullanımı Ev kurallarına tabidir. Bir grafikte kullanmak için favorilere ekleyebilirsiniz.

Bu komut dosyasını bir grafikte kullanmak ister misiniz?

Feragatname