该策略是一个基于价格波动的多重趋势追踪系统,通过分析连续三个交易周期的最高点和最低点变化来识别市场趋势。策略采用动态止损和获利方式,在保护资金的同时追求稳定收益。这种方法特别适合在趋势明显的市场环境中应用,能够有效捕捉中长期的价格走势。
策略的核心逻辑建立在价格运动的连续性和趋势延续性原理上。具体来说,策略通过以下步骤运作: 1. 趋势识别机制:连续监测三个周期的最高点和最低点,当出现三个连续上升的最低点时,系统识别为上升趋势;当出现三个连续下降的最高点时,系统识别为下降趋势。 2. 信号生成系统:在确认趋势后,系统自动生成相应的买入或卖出信号。 3. 风险管理系统:每个交易都配备了动态的止损和获利点,止损距离为2个单位,获利目标为6个单位。
这是一个设计合理的趋势跟踪策略,通过多重确认机制提高了交易的可靠性。虽然存在一些需要优化的地方,但整体思路清晰,适合作为基础策略框架进行进一步完善和个性化调整。策略的核心优势在于其简单而有效的趋势识别机制,配合合理的风险管理系统,能够在大趋势市场中取得不错的效果。
/*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")