0bps

Strategy vault / Breakout

Trend Following Strategy Based on Pivot Point Breakout

This strategy is named "Trend Following Strategy Based on Pivot Point Breakout". It identifies key support and resistance levels, and trades breakouts of these levels to follow trends. The logic is: 1. Calculate the…

Author
ChaoZhang
Complexity
Starter · 29 lines
Parameters
2
Backtest bar
3d · position
Tested on
BTC/USDT · futures

This strategy is named "Trend Following Strategy Based on Pivot Point Breakout". It identifies key support and resistance levels, and trades breakouts of these levels to follow trends.

The logic is:

  1. Calculate the highest high and lowest low prices over a period as key support/resistance levels.

  2. When prices break above the previous day's high pivot, a buy signal is generated.

  3. When prices break below the previous day's low pivot, a sell signal is generated.

  4. Quickly follow the trend after breakout occurs. If support is broken again, a stop loss exits.

The advantage is capitalizing on pivot breakout timing for trend trading. But indicator patterns should be watched to avoid excessive uncertain signals during ranging markets.

In summary, watching pivotal support/resistance level breakouts is a relatively simple and intuitive tracking approach. But traders still need confirmation from additional technical indicators, and parameter tuning, for the strategy to Both profit from trend entries and timely stop losses.

Parameters

NameDefaultWhat it controls
v_input_110left
v_input_210right

Source Pine Script

/*backtest
start: 2022-09-12 00:00:00
end: 2023-09-12 00:00:00
period: 3d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Yo_adriiiiaan

//@version=4
strategy("Breakout Strategy", overlay = true, commission_type=strategy.commission.percent,commission_value=0, initial_capital = 1000,  default_qty_type=strategy.percent_of_equity, default_qty_value=100)
left =  input(10)
right = input(10)
pivot_high = 0.000
pivot_low = 0.000
pivot_high := nz(pivothigh(high,left,right), pivot_high[1])
pivot_low := nz(pivotlow(low,left,right), pivot_low[1])
plot(pivot_high)
plot(pivot_low)
breakout_bull = close > pivot_high[1]
breakdown_bear = close < pivot_low[1]

barcolor(close > pivot_high[1]? color.green:close < pivot_low[1]? color.red:close < pivot_high[1]? color.orange:na)
strategy.entry("Long", strategy.long, when = breakout_bull)
strategy.close_all(when = breakdown_bear) 
//strategy.entry("Short", strategy.short, when = breakdown_bear)

Published by ChaoZhang on the FMZ strategy square · last modified 2023-09-13. 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/Trend-Following-Strategy-Based-on-Pivot-Point-Breakout.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