Breakout Scalper Catching Trend Changes Quickly
The Breakout Scalper strategy is a breakout trading strategy that utilizes fast and slow moving averages to identify trend changes. It sets up entry stops and trailing exit stops for risk management. The strategy…

Overview
The Breakout Scalper strategy is a breakout trading strategy that utilizes fast and slow moving averages to identify trend changes. It sets up entry stops and trailing exit stops for risk management. The strategy closes positions manually when the market goes sideways. It is suitable for volatile instruments to capitalize on fast trend shifts.
Strategy Logic
The strategy employs a fast window and a slow window. The default periods are 13 and 52 respectively. The fast window captures short-term trends while the slow window determines overall market direction. The mid prices of the two windows are plotted. When the fast mid-price crosses above the slow mid-price, an uptrend may be forming. When the fast mid-price crosses below the slow one, a downtrend may be starting.
When the fast mid-price is above the slow mid-price, and the instant price is also above the fast mid-price, a buy signal is generated. The entry stop is placed at the slow window's highest price. When the fast mid-price is below the slow one, and the instant price is below the fast mid-price, a sell signal is triggered, with the entry stop at the slow window's lowest price.
In addition, exit stops are defined for risk control. The long exit stop is the max of the fast and slow windows' lowest prices. The short exit stop is the min of the fast and slow windows' highest prices. This ensures the stops are placed outside the current trend direction for risk mitigation.
Positions are closed when the entry conditions are no longer valid, avoiding unnecessary losses during sideways markets.
Advantage Analysis
The key advantages of this strategy include:
Quickly catches trend changes suitable for volatile assets. The combination of the fast and slow windows enables responsive trend change detection.
Effective risk management via reasonable stops. The stops allow timely exits to control losses.
Simple and clear logic based on moving average crosses and stops. Easy to understand and implement.
Easily optimizable and extensible. Parameters can be tuned and more indicators can be added.
Risk Analysis
The main risks are:
Fast window prone to noise. Market noise can generate incorrect signals.
Slow window lag. Turning points may be detected late.
Stops too close to market. Stops based directly on window prices may be too tight.
Sideways markets lead to whipsaws. Choppy markets generate false signals.
Mitigations:
Optimize fast window and add filters.
Improve slow window and add confirming indicators.
Buffer stops from market price.
Detect sideways and avoid signals.
Optimization Opportunities
The strategy can be enhanced in several aspects:
Optimize window periods for different assets.
Add position sizing for better risk control.
Implement profit taking mechanisms.
Add more filters to create robust signals.
Incorporate pattern detection like triangles and divergences.
Utilize machine learning to optimize parameters.
Conclusion
The Breakout Scalper aims to catch trend changes quickly based on fast and slow moving average crosses. It is suitable for volatile markets like gold. The stops provide risk management. The simple logic makes it easy to understand and optimize. The identified risks and enhancements offer ways to improve the strategy further. Overall, this is an efficient trend trading system that can be refined into a robust approach.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_1 | 13 | Fast Window |
| v_input_2 | 52 | Slow Window |
| v_input_3 | 3 | Instant Period |
Source Pine Script
/*backtest
start: 2023-10-17 00:00:00
end: 2023-10-24 00:00:00
period: 30m
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=2
strategy("Breakout Scalper", overlay=true)
fast_window = input(title="Fast Window", defval=13, minval=1)
slow_window = input(title="Slow Window", defval=52, minval=1)
instant_period = input(title="Instant Period", defval=3, minval=1)
fast_low = lowest(fast_window)
fast_high = highest(fast_window)
fast_mid = (fast_low + fast_high) / 2
slow_low = lowest(slow_window)
slow_high = highest(slow_window)
slow_mid = (slow_low + slow_high) / 2
instant_price = ema(close, instant_period)
plot(instant_price, title="Instant Price", color=black, transp=50)
fp = plot(fast_mid, title="Fast Mid", color=green)
sp = plot(slow_mid, title="Slow Mid", color=red)
fill(fp, sp, color=(fast_mid > slow_mid ? green : red))
is_buy_mode = (instant_price > fast_mid) and (fast_mid > slow_mid)
is_sell_mode = (instant_price < fast_mid) and (fast_mid < slow_mid)
entry_color = is_buy_mode ? green : (is_sell_mode ? red : na)
exit_color = is_buy_mode ? red : (is_sell_mode ? green : na)
entry_buy_stop = slow_high
entry_sell_stop = slow_low
exit_buy_stop = max(fast_low, slow_low)
exit_sell_stop = min(fast_high, slow_high)
strategy.entry("long", strategy.long, stop=entry_buy_stop, when=is_buy_mode)
strategy.exit("stop", "long", stop=exit_buy_stop)
strategy.entry("short", strategy.short, stop=entry_sell_stop, when=is_sell_mode)
strategy.exit("stop", "short", stop=exit_sell_stop)
strategy.close("long", when=(not is_buy_mode))
strategy.close("short", when=(not is_sell_mode))
entry_buy_stop_color = (strategy.position_size == 0) ? (is_buy_mode ? green : na) : na
plotshape(entry_buy_stop, location=location.absolute, color=entry_buy_stop_color, style=shape.circle)
entry_sell_stop_color = (strategy.position_size == 0) ? (is_sell_mode ? red : na) : na
plotshape(entry_sell_stop, location=location.absolute, color=entry_sell_stop_color, style=shape.circle)
exit_buy_stop_color = (strategy.position_size > 0) ? red : na
plotshape(exit_buy_stop, location=location.absolute, color=exit_buy_stop_color, style=shape.xcross)
exit_sell_stop_color = (strategy.position_size < 0) ? green : na
plotshape(exit_sell_stop, location=location.absolute, color=exit_sell_stop_color, style=shape.xcross)
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/Breakout-Scalper-Catching-Trend-Changes-Quickly.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
- 20Bitcoin and Gold 5 Minute Scalping Strategy 20Pine Script · Scalping · 1h
- Scalping EMA ADX RSI with Buy SellPine Script · Scalping · 5m
- Session Breakout Scalping StrategyPine Script · Scalping · 1h
- Super ScalperPine Script · Scalping · 1m
- Advanced Multi Trend Confirmation EMA Supply Demand Zone Dynamic Scalping StrategyPine Script · Scalping · 1d
- Bollinger Awesome Alert R1Pine Script · Scalping · 1h