
이 전략은 쌍평선과 무작위 지표 (Stochastic) 를 기반으로 한 트렌드 추적 거래 시스템이다. 이 전략은 평선 시스템을 결합하여 시장의 흐름을 판단하며, 무작위 지표를 사용하여 과매도 영역의 교차 신호를 포착하고, 위험을 제어하기 위해 동적 인 스톱 스탠드 수준을 설정한다. 이 방법은 거래 신호의 신뢰성을 보장하고, 각 거래의 위험-이익 비율을 효과적으로 관리한다.
이 전략은 다음과 같은 핵심 요소에 의존합니다.
구매 조건은 동시에 충족되어야 합니다:
“이런 일이 벌어질 수 있다.
이것은 트렌드 추적과 동적 거래를 결합한 완전한 전략 시스템이다. 일률적 시스템과 무작위 지표의 조합 사용으로 거래 방향이 주 트렌드에 부합하는지 확인하고 적절한 가격 영역에서 거래 할 수 있습니다. 또한, 전략은 완벽한 위험 관리 메커니즘을 포함하고 있으며, 동적 중지 손실과 고정 위험 이익 비율을 사용하여 위험을 제어합니다.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-12-11 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © quadawosanya
//@version=5
//indicator("My script")
//@version=5
strategy("EMA-Stochastic Strategy", overlay=true)
// EMA settings
ema50 = ta.ema(close, 50)
ema150 = ta.ema(close, 150)
// Stochastic settings
kLength = 14
dLength = 3
smoothK = 3
stochK = ta.sma(ta.stoch(close, high, low, kLength), smoothK)
stochD = ta.sma(stochK, dLength)
// Parameters for Stop Loss and Take Profit
var float stopLossLevel = na
var float takeProfitLevel = na
// Buy condition
buySignal = (close > ema50 and close > ema150) and (ema50 > ema150) and (stochK < 30 and ta.crossover(stochK, stochD))
// Sell condition
sellSignal = (close < ema50 and close < ema150) and (ema50 < ema150) and (stochK > 70 and ta.crossunder(stochK, stochD))
// Previous low for Stop Loss for Buy
lowBeforeBuy = ta.lowest(low, 5)
// Previous high for Stop Loss for Sell
highBeforeSell = ta.highest(high, 5)
// Entry and exit logic
if (buySignal)
stopLossLevel := lowBeforeBuy
risk = close - stopLossLevel
takeProfitLevel := close + 2 * risk
strategy.entry("Buy", strategy.long)
strategy.exit("Take Profit/Stop Loss", "Buy", stop=stopLossLevel, limit=takeProfitLevel)
if (sellSignal)
stopLossLevel := highBeforeSell
risk = stopLossLevel - close
takeProfitLevel := close - 2 * risk
strategy.entry("Sell", strategy.short)
strategy.exit("Take Profit/Stop Loss", "Sell", stop=stopLossLevel, limit=takeProfitLevel)
// Plotting EMAs
plot(ema50, color=color.blue, title="50 EMA")
plot(ema150, color=color.red, title="150 EMA")
// Visualize Buy and Sell signals
plotshape(series=buySignal, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(series=sellSignal, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")
// Visualize Stop Loss and Take Profit levels
plot(stopLossLevel, color=color.red, style=plot.style_line, linewidth=2, title="Stop Loss")
plot(takeProfitLevel, color=color.green, style=plot.style_line, linewidth=2, title="Take Profit")
plot(close)