0bps

Strategy vault / Breakout

Auto Trading Strategy Based on RB SSL Channel

This strategy designs an automated trading system based on the RB SSL channel indicator, using channel breakouts for long/short position switching. It belongs to the category of short-term trend following strategies…

Author
ChaoZhang
Complexity
Starter · 50 lines
Parameters
2
Backtest bar
1h · intraday
Tested on
BTC/USDT · futures

Overview

This strategy designs an automated trading system based on the RB SSL channel indicator, using channel breakouts for long/short position switching. It belongs to the category of short-term trend following strategies. The strategy is simple and practical, easy to automate.

Strategy Logic

The core of this strategy is to identify trend direction using the RB SSL channel indicator. The RB SSL channel consists of an upper band and a lower band, formed by the SMA of highest price and lowest price over a certain period. A close above the upper band signals long, while a close below the lower band signals short.

Specifically, the code first calculates the SMA of highest and lowest prices over a period as the upper and lower bands of the channel. It then judges if price breaks the bands for long/short signals. When going long, the upper band is used as the stop loss; when going short, the lower band is used as the stop loss.

Advantage Analysis

  • Using channel breakouts to determine trend direction provides clear signals.
  • Stop loss placement is reasonable for good risk control.
  • The code is simple and easy to understand, easy to automate.
  • Balances trend following and short-term trading, with large profit space.

Risks and Improvements

  • Relying solely on channel indicator, weak in complex market situations.
  • Cannot effectively filter ranging markets, prone to being trapped.
  • Period parameter greatly impacts results, requiring careful optimization.
  • Can consider combining other indicators for better accuracy.
  • Can add mobile stop loss based on ATR etc for better risk control.

Summary

The strategy has an overall clear and simple logic, using channel indicator for trend direction and channel lines for stop loss, very suitable for automation. But relying solely on simple indicators means weak judgment in complex markets. Improvements like multi-indicator combo, parameter optimization, mobile stop loss can make the strategy more robust.

Parameters

NameDefaultWhat it controls
v_input_113Period
v_input_213Period

Source Pine Script

/*backtest
start: 2023-08-26 00:00:00
end: 2023-09-25 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4

strategy("Algo 4- Auto", overlay=true)

// FULL ALGO INFORMATION- Coded by Forexcakemix



//LET THE GAMES COMMENCE :p

/////////////////////////////////////////////////

//RB SSL CHANNEL
period=input(title="Period", defval=13)
len=input(title="Period", defval=13)
smaHigh=sma(high, len)
smaLow=sma(low, len)
Hlv = 0.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=#FF0000)
plot(sslUp, linewidth=2, color=#00FF00)

ssl_l=crossover(sslUp,sslDown)
ssl_s=crossunder(sslUp,sslDown)


//Conditions For Trades

long= ssl_l 
short=  ssl_s

//Strategy Conditions

strategy.entry("Long", strategy.long,when=long)
strategy.entry("Short", strategy.short, when=short)

strategy.close("Long", when = ssl_s )  
strategy.close("Short", when = ssl_l ) 

Published by ChaoZhang on the FMZ strategy square · last modified 2023-09-26. 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.

in Claude Code, Cursor, Codex & 4 more
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Auto-Trading-Strategy-Based-on-RB-SSL-Channel.md
  1. npx agenkit install engineering-kit in your project
  2. Paste the command into your agent and approve each phase
  3. 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

esc

Try , , or .

↑↓ move↵ open