资源加载中... loading...

SSL Channel Breakout Strategy with Trailing Stop Loss

Author: ChaoZhang, Date: 2023-10-25 17:40:37
Tags:

img

Overview

This strategy uses the SSL channel indicator to identify trend direction and trade breakouts with momentum. It goes long when price breaks above the SSL upper band and goes short when price breaks below the SSL lower band. Moving stop loss and trailing stop loss are used to control risks.

Strategy Logic

  1. Calculate upper and lower bands of SSL channel using SMA of high and low prices with N periods.

  2. Generate long signal when close is above upper band, and short signal when close is below lower band.

  3. Set fixed stop loss at the opposite band after entry, to limit losses.

  4. Set trailing stop loss that follows price movement, to lock in profits.

  5. Exit when price hits either fixed stop loss or trailing stop loss.

Advantages

  1. Use channel indicator to determine trend direction, avoid false breakouts.

  2. Dual stop loss combines profit taking and risk control.

  3. High trading frequency fits ultra short-term trading.

  4. Flexible parameters adaptable to personal trading style.

  5. Auto detect long/short, no directional judgement needed.

Risks

  1. Short-term trading prone to news shocks and high volatility.

  2. Fixed stop loss may trigger oversized loss after breakout.

  3. Improper trailing stop loss may lead to premature exit.

  4. Channel breakouts susceptible to false signals.

  5. Only suitable for experienced short-term traders.

Solutions:

  1. Set reasonable fixed stop loss to limit loss per trade.

  2. Optimize trailing stop loss levels to avoid early exit.

  3. Add volume filter to confirm true breakout.

  4. Manage position sizing, scale in to control risk exposure.

Optimization

  1. Optimize SMA periods to find best length.

  2. Try other channel indicators like BB, KD etc.

  3. Add volume indicator to confirm breakout credibility.

  4. Consider turnover rate to avoid low volume false breakout.

  5. Test different holding periods to find optimal exit timing.

  6. Test fixed and trailing stop loss parameters.

  7. Adjust position sizing strategy to maximize capital efficiency.

Summary

This strategy combines SSL channel directional bias and breakout signals, with dual stop loss management. It reacts fast to capture trends, suitable for high frequency trading. Beware of false breakouts, refine stop loss mechanisms, and control position sizing. With further optimization, it has the potential to be an effective ultrashort-term trading strategy.


/*backtest
start: 2023-09-24 00:00:00
end: 2023-10-24 00:00:00
period: 2h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
strategy("SSL Channel Cross with Trailing Stop and Stop Loss", overlay=true)

period = input(title="Period", defval=10)
len = input(title="Length", defval=10)
smaHigh = sma(high, len)
smaLow = sma(low, len)

Hlv = 0
Hlv := close > smaHigh ? 1 : close < smaLow ? -1 : Hlv[1]

sslDown = Hlv < 0 ? smaHigh : smaLow
sslUp = Hlv < 0 ? smaLow : smaHigh

plot(sslDown, linewidth=2, color=color.red)
plot(sslUp, linewidth=2, color=color.lime)

longCondition = crossover(sslUp, sslDown)
shortCondition = crossunder(sslUp, sslDown)

// Define el tamaño del trailing stop en puntos (ajusta según tu preferencia)
trailingStopSize = input(title="Trailing Stop Size (in Points)", defval=10)

var float trailingStopPrice = na
var float stopLossPrice = na

if (longCondition)
    // Si se cumple la condición de compra, configura la posición larga, el trailing stop y el stop loss
    strategy.entry("Long", strategy.long)
    trailingStopPrice := low - trailingStopSize
    stopLossPrice := sslDown

if (shortCondition)
    // Si se cumple la condición de venta corta, configura la posición corta, el trailing stop y el stop loss
    strategy.entry("Short", strategy.short)
    trailingStopPrice := high + trailingStopSize
    stopLossPrice := sslUp

// Calcula el trailing stop
if (strategy.position_size > 0)
    trailingStopPrice := max(trailingStopPrice, stopLossPrice)
    if (close < trailingStopPrice)
        strategy.close("ExitLong", comment="Trailing Stop Long")

if (strategy.position_size < 0)
    trailingStopPrice := min(trailingStopPrice, stopLossPrice)
    if (close > trailingStopPrice)
        strategy.close("ExitShort", comment="Trailing Stop Short")


More