SSL Channel Breakout Strategy with Trailing Stop Loss
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…

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
Calculate upper and lower bands of SSL channel using SMA of high and low prices with N periods.
Generate long signal when close is above upper band, and short signal when close is below lower band.
Set fixed stop loss at the opposite band after entry, to limit losses.
Set trailing stop loss that follows price movement, to lock in profits.
Exit when price hits either fixed stop loss or trailing stop loss.
Advantages
Use channel indicator to determine trend direction, avoid false breakouts.
Dual stop loss combines profit taking and risk control.
High trading frequency fits ultra short-term trading.
Flexible parameters adaptable to personal trading style.
Auto detect long/short, no directional judgement needed.
Risks
Short-term trading prone to news shocks and high volatility.
Fixed stop loss may trigger oversized loss after breakout.
Improper trailing stop loss may lead to premature exit.
Channel breakouts susceptible to false signals.
Only suitable for experienced short-term traders.
Solutions:
Set reasonable fixed stop loss to limit loss per trade.
Optimize trailing stop loss levels to avoid early exit.
Add volume filter to confirm true breakout.
Manage position sizing, scale in to control risk exposure.
Optimization
Optimize SMA periods to find best length.
Try other channel indicators like BB, KD etc.
Add volume indicator to confirm breakout credibility.
Consider turnover rate to avoid low volume false breakout.
Test different holding periods to find optimal exit timing.
Test fixed and trailing stop loss parameters.
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.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_1 | 10 | Period |
| v_input_2 | 10 | Length |
| v_input_3 | 10 | Trailing Stop Size (in Points) |
Source Pine Script
/*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")
Published by ChaoZhang on the FMZ strategy square · last modified 2023-10-25. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.
Build this with AgenKit
A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/SSL-Channel-Breakout-Strategy-with-Trailing-Stop-Loss.md- npx agenkit install engineering-kit in your project
- Paste the command into your agent and approve each phase
- Get tests, backtest, risk controls and a paper-trading switch
Understand it first
Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.
Related specs
- Adaptive Multi Period Trading Strategy Based on Wave Trend Momentum BreakoutPine Script · Breakout · 2h
- Dynamic Bollinger Bands Breakout Quantitative Trading StrategyPine Script · Breakout · 2d
- Flexible Long Short Trading Strategy Based on Keltner ChannelsPine Script · Breakout · 1d
- Mean Reversion Trend Following Strategy Based on HA Momentum BreakoutPine Script · Breakout · 45m
- Momentum Breakout Trading Strategy 435896Pine Script · Breakout · 1d
- Moving Average Based Supply Demand Zone Trading System with Dynamic Risk ManagementPine Script · Breakout · 1h