
이 거래 전략은 100주기 지수 이동 평균 ((EMA100), 당기기 흑자/손실 ((NUPL) 과 상대적으로 흑자 3가지 지표에 기초하여 가격과 EMA100의 교차와 NUPL와 상대적으로 흑자 2가지의 마이너스를 판단하여 거래 신호를 생성한다. 가격이 EMA100을 넘어서서 NUPL과 상대적으로 흑자 2가지가 양호할 때 다중 신호를 유발한다. 가격이 EMA100을 넘어서서 NUPL과 상대적으로 흑자 2가지가 마이너스할 때 공백 신호를 유발한다. 이 전략은 10%의 고정 지위를 취하고 10%의 스톱 손실을 설정한다.
이 거래 전략은 EMA100, NUPL 및 상대적으로 수익이 달성되지 않은 세 가지 지표를 통해 거래 신호를 생성하며, 논리적으로 명확하고, 위험을 제어할 수 있으며, 적응력이 강하다는 장점이 있습니다. 또한 가짜 신호, 지연성 및 변수 최적화와 같은 위험이 있습니다. 향후에는 변수 최적화, 신호 필터링, 동적 포지션 관리 및 다중 공간 조합과 같은 방법으로 전략을 최적화하고 향상시킬 수 있습니다.
/*backtest
start: 2023-06-11 00:00:00
end: 2024-06-16 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Scalping Strategy with EMA 100, NUPL, and Relative Unrealized Profit", overlay=true)
// Input for EMA period
emaPeriod = input.int(100, title="EMA Period", minval=1)
ema100 = ta.ema(close, emaPeriod)
plot(ema100, color=color.blue, title="EMA 100")
// Placeholder function for NUPL (Net Unrealized Profit/Loss)
// Replace this with actual NUPL data or calculation
NUPL = close * 0.0001 // Dummy calculation
// Placeholder function for relative unrealized profit
// Replace this with actual relative unrealized profit data or calculation
relativeUnrealizedProfit = close * 0.0001 // Dummy calculation
// Define conditions for long and short entries
longCondition = ta.crossover(close, ema100) and NUPL > 0 and relativeUnrealizedProfit > 0
shortCondition = ta.crossunder(close, ema100) and NUPL < 0 and relativeUnrealizedProfit < 0
// Plot buy and sell signals on the chart
plotshape(series=longCondition, location=location.belowbar, color=color.green, style=shape.labelup, title="Buy Signal")
plotshape(series=shortCondition, location=location.abovebar, color=color.red, style=shape.labeldown, title="Sell Signal")
// Calculate stop loss levels
longStopLoss = close * 0.90
shortStopLoss = close * 1.10
// Strategy entry and exit rules
if (longCondition)
strategy.entry("Long", strategy.long, stop=longStopLoss)
if (shortCondition)
strategy.entry("Short", strategy.short, stop=shortStopLoss)
// Set stop loss levels for active positions
if (strategy.position_size > 0)
strategy.exit("Exit Long", "Long", stop=longStopLoss)
if (strategy.position_size < 0)
strategy.exit("Exit Short", "Short", stop=shortStopLoss)
// Alerts for long and short entries
alertcondition(longCondition, title="Long Entry Alert", message="Long entry signal based on EMA 100, NUPL, and relative unrealized profit")
alertcondition(shortCondition, title="Short Entry Alert", message="Short entry signal based on EMA 100, NUPL, and relative unrealized profit")
// Visualize the entry conditions
plotshape(series=longCondition, location=location.belowbar, color=color.blue, style=shape.cross, title="Long Condition")
plotshape(series=shortCondition, location=location.abovebar, color=color.red, style=shape.cross, title="Short Condition")