
Die Strategie kombiniert die drei technischen Indikatoren eines einfachen Moving Averages (SMA), eines unterstützenden Widerstands und einer Erhöhung des Handelsvolumens, um eine umfassende Handelsstrategie zu erstellen. Die Hauptidee der Strategie besteht darin, bei einem Preisbruch über die SMA-Mittellinie, einem unterstützenden Widerstand und einer erhöhten Handelsmenge zu handeln, während die Stop-Loss-Bedingungen zur Risikokontrolle festgelegt werden.
Die Strategie ist in der Lage, Trendchancen zu ergreifen und gleichzeitig das Handelsrisiko zu kontrollieren. Die Strategie hat jedoch auch eine gewisse Einschränkung. Die Strategie kann in Zukunft verbessert werden, um ihre Stabilität und Profitabilität zu verbessern, indem andere technische Indikatoren eingeführt werden, die Berechnung der Resistenz der Unterstützung optimiert wird, die Handelsmengen-Indikatoren geglättet werden und die Bedingungen für die Stop-Loss-Optimierung verbessert werden.
/*backtest
start: 2023-06-08 00:00:00
end: 2024-06-13 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy("Advanced Entry Conditions with Support/Resistance, SMA, and Volume", overlay=true)
// Inputs
length = input(20, title="SMA Length")
stopLossPerc = input(1, title="Stop Loss Percentage", type=input.float) / 100
leftBars = input(15, title="Left Bars")
rightBars = input(15, title="Right Bars")
distanceThresh = input(1, title="Distance Threshold from Support/Resistance", type=input.float) / 100
// Calculations
smaValue = sma(close, length)
highUsePivot = fixnan(pivothigh(leftBars, rightBars)[1])
lowUsePivot = fixnan(pivotlow(leftBars, rightBars)[1])
// Volume Calculation
volumeIncrease = volume > volume[1]
// Entry Conditions
longEntryCondition = close[0] > close[1] and close[1] > smaValue and close[0] > smaValue and close[0] > lowUsePivot and close[1] > lowUsePivot and abs(close[0] - highUsePivot) > distanceThresh and volumeIncrease
shortEntryCondition = close[0] < close[1] and close[1] < smaValue and close[0] < smaValue and close[0] < lowUsePivot and close[1] < lowUsePivot and abs(close[0] - highUsePivot) > distanceThresh and volumeIncrease
// Calculate stop loss levels
longStopLoss = close * (1 - stopLossPerc)
shortStopLoss = close * (1 + stopLossPerc)
// Strategy Logic
strategy.entry("Long", strategy.long, when=longEntryCondition)
strategy.exit("Exit Long", "Long", stop=longStopLoss)
strategy.entry("Short", strategy.short, when=shortEntryCondition)
strategy.exit("Exit Short", "Short", stop=shortStopLoss)
// Plotting
plot(smaValue, color=color.blue, title="SMA")
plot(highUsePivot, color=color.red, linewidth=2, title="Resistance")
plot(lowUsePivot, color=color.green, linewidth=2, title="Support")
plotshape(series=longEntryCondition, location=location.belowbar, color=color.green, style=shape.labelup, title="Long Entry")
plotshape(series=shortEntryCondition, location=location.abovebar, color=color.red, style=shape.labeldown, title="Short Entry")
// Background Color
bgcolor(longEntryCondition ? color.new(color.green, 90) : shortEntryCondition ? color.new(color.red, 90) : na)