Strategy · Pine Script v6 · On the chart

PA Trend Breakout Strategy

by Chovy-King

A strategy with BTC, gold and custom presets that enters in the direction of the trend when a strong candle breaks the latest swing high or low.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code415
Settings36inputs
LicenceNone stated
Last update6 months ago30 Apr 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above. It reads the file straight from GitHub.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new strategy, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.

Source Code

The code stays on GitHub. The author has not published this script under an open licence, so ForexR does not show its code. Copy script reads the file straight from GitHub into your clipboard, so you can still try it on your own chart. Ask the author before reusing the code anywhere else.

Overview

Filters include a higher-timeframe trend check, a volume surge, body and range thresholds, a prior consolidation, an RSI band and EMA slope. Stops sit beyond the swing point with an ATR buffer, with two reward-to-risk targets and a partial exit option. Sizing can follow a risk percentage of equity.

Details

Published by

Chovy-King on GitHub

Type

Strategy, Pine Script v6

Draws

On the price chart

Category

Breakout, Trend

Markets

Crypto, Gold

Timeframes

M15-H1, H4 and above

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
品种(BTC / GOLD / Custom)stringBTCpreset
允许做多booltrueallowLong
允许做空booltrueallowShort
EMA 快线周期int20maFastLen
EMA 中线周期int60maMidLen
ATR 周期int14atrLen
波段点左侧 K 线数(Custom 使用)int3swingLeft_i
波段点右侧 K 线数(Custom 使用)int3swingRight_i
启用 HTF 共振过滤(建议开)booltrueenHTF_i
HTF 周期(Custom 使用)timeframe240htfTF_i
交易量放大过滤(Custom 使用)booltrueuseVolFilter_i
突破 K 线量 ≥ 20EMA 均量 × Nfloat1.3minVolMult_i
Show all 36 settings
SettingTypeDefaultVariable
强趋势棒 body/range 下限float0.65minBodyRatio_i
强趋势棒 range ≥ N × ATRfloat1.0minRangeATR_i
收盘价至少超突破位 N × ATR(过滤毛刺)float0.10minBreakATR_i
突破前盘整观察 N 根 K 线int6consolidBars_i
盘整 N 根 K 线极差 ≤ M × ATRfloat2.0maxConsolidATR_i
RSI 周期int14rsiLen
多头 RSI 下限(太弱不追)float45rsiMinLong_i
多头 RSI 上限(太超买不追)float75rsiMaxLong_i
空头 RSI 下限(太超卖不追)float25rsiMinShort_i
空头 RSI 上限(太强不追)float55rsiMaxShort_i
EMA20 斜率必须 ≥ N(多) / ≤ -N(空)float0.001minSlope_i
两次同向信号最少间隔 N 根(避免连续回撤)int10minBarsBetween_i
SL 在摆动点外再扩 N × ATR(Custom 使用)float0.4slBufATR_i
TP1 = N × R(Custom 使用)float1.5rr1_i
TP2 = N × R(Custom 使用)float2.5rr2_i
按单笔风险% 动态计算仓位booltrueuseRiskSizing
单笔风险占账户 %float1.0riskPerTrade
分批止盈(TP1 平 N% + 剩余 TP2 全平)booltrueuseTPSplit
TP1 平仓比例 %float50.0tp1PctClose
TP1 触发后把 SL 移至入场价(保本)booltruemoveSLToBE
限制回测日期范围boolfalseuseDateRange
开始时间timetimestamp("01 Jan 2020 00:00 +0000")startDate
结束时间timetimestamp("31 Dec 2099 23:59 +0000")endDate
信号 K 线背景高亮booltrueshowSigBG
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

This trend-following strategy executes a classic Donchian channel breakout system designed to cross-validate backtest results against external framework benchmarks. It triggers a long entry when the closing price breaks above the highest high of the prior entr

Strategy v6 BreakoutTrend
Updated yesterday · AGPL-3.0 GitHub repository of Forven S01509 - Simple Donchian 20/10 Breakout
257 stars

This strategy plots running pivot highs as red R circles and pivot lows as blue S circles directly on the price chart. It computes an EMA 3 and a Cto trend line from close prices, then generates long signals on upward EMA-Cto crossovers combined with price pos

Strategy v6 TrendMoving averages Repaints
Updated 6 weeks ago · None stated GitHub repository of Best Chart 1m Strategy Candle Bar

12/26-IT Strategy

by hasnocool
106 stars

This strategy executes trades based on crossovers between a 12-period and a 26-period exponential moving average (EMA). Long positions can be filtered by pivot resistance breakouts and RSI boundary ranges. For trade management, it provides two configurable par

Strategy v5 TrendMoving averages
Updated 2 years ago · GPL-3.0 GitHub repository of 12/26-IT Strategy

均线突破交易系统

by tangly1024
76 stars

This strategy trades long breakouts of a fast and a slow moving average on the price chart. It opens a long position when price crosses above either average, using a percentage of equity as size. It reduces the position by a set share when the high reaches the

Strategy v5 TrendMoving averages
Updated 5 months ago · None stated GitHub repository of 均线突破交易系统
53 stars

This strategy enters long or short on the price chart when price is on the correct side of a 200-period EMA, MACD agrees, RSI is not at the opposing extreme, ADX exceeds a threshold, volume beats a 20-bar average, and close breaks the recent high or low. A tim

Strategy v6 TrendOscillators & momentum
Updated 2 months ago · MPL-2.0 GitHub repository of BTCUSD 5M Optimized Strategy

More strategys

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers