
Стратегия является торговой системой, основанной на выявлении равнолинейных трендов и ложных прорывов в поддержке. Стратегия определяет рыночные тенденции с помощью 50-циклических и 200-циклических простых движущихся средних, создает торговый сигнал в сочетании с ложными форматами прорывов в поддержке и использует ATR (средняя реальная волновая amplitude) для динамического установления стоп-позиции, устанавливая цель получения прибыли в точке прорыва.
Основная логика стратегии включает в себя следующие ключевые элементы:
Стратегия многократного прорыва в устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к устойчивости к у
/*backtest
start: 2019-12-23 08:00:00
end: 2024-11-26 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("False Break Trading Strategy", overlay=true)
// Define inputs for strategy parameters
sma50Length = input.int(50, title="SMA 50 Length")
sma200Length = input.int(200, title="SMA 200 Length")
atrLength = input.int(14, title="ATR Length")
lookbackPeriod = input.int(10, title="Swing High Lookback Period")
// Calculate SMAs
sma50 = ta.sma(close, sma50Length)
sma200 = ta.sma(close, sma200Length)
// Calculate ATR
atr = ta.atr(atrLength)
// Check if we are in an uptrend
isUptrend = sma50 > sma200
// Calculate Pivot, Support, and Target Profit (Swing High)
pivot = (high[1] + low[1] + close[1]) / 3
support = (2 * pivot) - high[1]
swingHigh = ta.highest(high, lookbackPeriod)
// Create signals for entry
var float entryPrice = na
var float stopLoss = na
var float targetProfit = na
longCondition = isUptrend and low[1] < support and close > support
if (longCondition)
entryPrice := open
stopLoss := low - atr
targetProfit := swingHigh
// Plot signals and lines on chart
plotshape(longCondition, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
// Plot levels for entry, stop loss, and target
plot(entryPrice, title="Entry Price", color=color.blue, linewidth=2, style=plot.style_linebr)
plot(stopLoss, title="Stop Loss", color=color.red, linewidth=2, style=plot.style_linebr)
plot(targetProfit, title="Target Profit", color=color.green, linewidth=2, style=plot.style_linebr)
// Backtest: Simulate exit points for the strategy
if (longCondition)
strategy.entry("Long", strategy.long)
if (na(stopLoss) == false and na(targetProfit) == false)
strategy.exit("Take Profit/Stop Loss", "Long", stop=stopLoss, limit=targetProfit)