
이 전략은 이동 평균선 추세 추종과 거래량 분석 방법을 결합한 5분 단위의 자동 거래 시스템입니다. 이 전략은 시장 동향을 파악하기 위해 50기간 단순 이동 평균(SMA)을 사용하고 거래 신호의 유효성을 확인하기 위해 거래량 분석을 도입합니다. 이 시스템은 완전 자동화된 거래를 실현하기 위해 고정된 손절매 및 수익 목표를 사용합니다.
전략의 핵심 논리에는 다음과 같은 핵심 구성 요소가 포함됩니다.
이 전략은 추세 추적과 거래량 분석을 결합하여 완전한 고빈도 거래 시스템을 구축합니다. 이 전략의 주요 장점은 다차원적인 신호 확인 메커니즘과 완벽한 위험 관리 시스템에 있습니다. 몇 가지 본질적인 위험은 있지만, 제안된 최적화 방향을 통해 전략의 안정성과 적응성을 더욱 개선할 수 있습니다. 이 전략은 특히 추세가 명확한 시장 환경에서 운영하는 데 적합하며, 합리적인 매개변수 최적화와 위험 관리를 통해 안정적인 거래 결과를 얻을 수 있을 것으로 기대됩니다.
/*backtest
start: 2024-01-10 00:00:00
end: 2025-01-08 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT","balance":49999}]
*/
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Jerryorange
//@version=6
//@version=6
strategy("Autonomous 5-Minute Robot", overlay=true, fill_orders_on_standard_ohlc=true)
// --- Inputs ---
maLength = input.int(50, title="Trend MA Length") // Moving average length for trend detection
volumeLength = input.int(10, title="Volume Length") // Length for volume analysis
stopLossPercent = input.float(3, title="Stop Loss (%)") // 3% stop loss
takeProfitPercent = input.float(29, title="Take Profit (%)") // 29% take profit
// --- Market Trend Detection ---
ma = ta.sma(close, maLength) // Simple moving average for trend direction
isBullish = close > ma // Market is bullish if the close is above the moving average
isBearish = close < ma // Market is bearish if the close is below the moving average
// --- Volume Analysis ---
buyVolume = (high != low) ? volume * (close - low) / (high - low) : 0
sellVolume = (high != low) ? volume * (high - close) / (high - low) : 0
totalVolume = volume
// --- Define Market Direction over Last 30 Minutes (6 candles in 5-minute chart) ---
lookback = 6 // 30 minutes / 5 minutes = 6 bars
prevClose = close[lookback] // Previous close 30 minutes ago
currentClose = close // Current close
uptrend = currentClose > prevClose and isBullish // Uptrend condition
downtrend = currentClose < prevClose and isBearish // Downtrend condition
// --- Strategy Logic ---
longCondition = uptrend and buyVolume > sellVolume // Buy signal when trend is up and buy volume exceeds sell volume
shortCondition = downtrend and sellVolume > buyVolume // Sell signal when trend is down and sell volume exceeds buy volume
// --- Entry and Exit Strategy ---
if (longCondition)
strategy.entry("Long", strategy.long)
if (shortCondition)
strategy.entry("Short", strategy.short)
// --- Exit Strategy based on Stop Loss and Take Profit ---
strategy.exit("Exit Long", "Long", stop=close * (1 - stopLossPercent / 100), limit=close * (1 + takeProfitPercent / 100))
strategy.exit("Exit Short", "Short", stop=close * (1 + stopLossPercent / 100), limit=close * (1 - takeProfitPercent / 100))
// --- Plotting for Visualization ---
plot(ma, color=color.blue, title="50-period MA") // Trend line
plotshape(longCondition, style=shape.labelup, location=location.belowbar, color=color.green, text="BUY")
plotshape(shortCondition, style=shape.labeldown, location=location.abovebar, color=color.red, text="SELL")