
이 전략은 볼링거 밴드 (Bollinger Bands) 지표를 사용하여, 가격이 상반도를 만질 때 공백하고, 하반도를 만질 때 더 많이하고, 동적 정지 지점을 설정하고, 지분 1%의 수익을 달성하면 평점이다. 이 전략의 핵심 아이디어는 가격이 항상 볼링거 밴드 내에서 변동하며, 평균 회귀의 특성을 가지고 있기 때문에 가격이 이동 평균선에서 너무 멀리 떨어져있을 때 역으로 작동하여 가격 차이의 이익을 얻을 수 있다.
이 전략은 폴링거 띠를 이용한 간단한 효과적인 거래 시스템을 구축하여 가격의 상향과 하향을 신호로 삼고, 동적 정지 방식을 사용하여 위험을 제어한다. 전략은 추세 상황에서 잘 작동하지만, 불안정한 시장에서 자주 거래하는 문제가 발생할 수 있다. 추세를 판단하고, 정지 및 손실을 최적화하고, 요인 조합, 기본 필터 등을 통해 전략을 개선하여 더 안정적인 수익을 얻을 수 있다.
/*backtest
start: 2024-04-01 00:00:00
end: 2024-04-30 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Future Price Prediction", overlay=true)
// Ayarlar
length = input.int(14, "Length")
mult = input.float(2.0, "Multiplier")
showBands = input.bool(true, "Show Bands")
takeProfitPercentage = 1.0
// Ortalama ve Standart Sapma Hesaplamaları
basis = ta.sma(close, length)
dev = mult * ta.stdev(close, length)
// Üst ve Alt Bantlar
upper = basis + dev
lower = basis - dev
// Grafikte Gösterim
plot(basis, color=color.blue, linewidth=2, title="Basis")
plot(showBands ? upper : na, color=color.red, linewidth=1, title="Upper Band")
plot(showBands ? lower : na, color=color.green, linewidth=1, title="Lower Band")
// Al-Sat Sinyalleri
longCondition = ta.crossover(close[1], lower[1]) and close[1] < open[1]
shortCondition = ta.crossunder(close[1], upper[1]) and close[1] > open[1]
// Kar al seviyeleri
float longTakeProfit = na
float shortTakeProfit = na
if longCondition
longTakeProfit := close * (1 + takeProfitPercentage / 100)
if shortCondition
shortTakeProfit := close * (1 - takeProfitPercentage / 100)
// Strateji Giriş ve Çıkış
if longCondition
strategy.entry("Buy", strategy.long)
strategy.exit("Take Profit", from_entry="Buy", limit=longTakeProfit)
if shortCondition
strategy.entry("Sell", strategy.short)
strategy.exit("Take Profit", from_entry="Sell", limit=shortTakeProfit)
// Al-Sat Sinyalleri Grafikte Gösterim
plotshape(series=longCondition, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(series=shortCondition, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")
// Bilgi Tablosu
var table data = table.new(position.bottom_right, 2, 2, frame_color=color.black, frame_width=1)
if barstate.islast
table.cell(data, 0, 0, "Current Price", text_color=color.white)
table.cell(data, 1, 0, str.tostring(close))
table.cell(data, 0, 1, "Predicted Basis", text_color=color.white)
table.cell(data, 1, 1, str.tostring(basis))