
This strategy is a multi-wave trend following system that identifies market trends by analyzing price changes across three consecutive trading periods through their highs and lows. The strategy employs dynamic stop-loss and take-profit mechanisms to protect capital while pursuing stable returns. This approach is particularly suitable for markets with clear trends, effectively capturing medium to long-term price movements.
The core logic is built on the principles of price movement continuity and trend continuation. Specifically, the strategy operates through the following steps: 1. Trend Identification Mechanism: Continuously monitors highs and lows over three periods, identifying an uptrend when three consecutive higher lows appear, and a downtrend when three consecutive lower highs occur. 2. Signal Generation System: Automatically generates corresponding buy or sell signals once a trend is confirmed. 3. Risk Management System: Each trade is equipped with dynamic stop-loss and take-profit points, with a stop-loss distance of 2 units and a profit target of 6 units.
This is a well-designed trend following strategy that enhances trading reliability through multiple confirmation mechanisms. While there are areas for optimization, the overall approach is clear and suitable as a basic strategy framework for further refinement and customization. The strategy’s core strength lies in its simple yet effective trend identification mechanism, coupled with a reasonable risk management system, capable of achieving good results in trending markets.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-11-28 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Indicatore Minimi e Massimi", overlay=true)
// Parametri di input per stop loss e take profit
stopLossDistance = input(2, title="Distanza Stop Loss")
takeProfitDistance = input(6, title="Distanza Take Profit")
// Funzione per il conteggio dei massimi e minimi
var int countUp = 0
var int countDown = 0
// Calcola i massimi e minimi
if (low > low[1] and low[1] > low[2])
countUp := countUp + 1
countDown := 0
else if (high < high[1] and high[1] < high[2])
countDown := countDown + 1
countUp := 0
else
countUp := 0
countDown := 0
// Segnali di acquisto e vendita
longSignal = countUp == 3
shortSignal = countDown == 3
// Impostazione dello stop loss e take profit
longStopLoss = close - stopLossDistance
longTakeProfit = close + takeProfitDistance
shortStopLoss = close + stopLossDistance
shortTakeProfit = close - takeProfitDistance
// Esegui le operazioni
if (longSignal)
strategy.entry("Long", strategy.long)
strategy.exit("Take Profit", "Long", limit=longTakeProfit, stop=longStopLoss)
if (shortSignal)
strategy.entry("Short", strategy.short)
strategy.exit("Take Profit", "Short", limit=shortTakeProfit, stop=shortStopLoss)
// Visualizza segnali sul grafico
plotshape(series=longSignal, location=location.belowbar, color=color.green, style=shape.labelup, text="Compra")
plotshape(series=shortSignal, location=location.abovebar, color=color.red, style=shape.labeldown, text="Vendi")