0bps

Strategy vault / Breakout

Fractal Breakout Momentum Trading Strategy with Take Profit Optimization

This strategy is a trend-following trading system based on price fractal theory, which identifies market fractal structures and combines fixed-point trigger conditions with take-profit settings for automated trading…

Author
ChaoZhang
Complexity
Starter · 52 lines
Parameters
0
Backtest bar
1d · swing
Tested on
BTC/USDT · futures

IMG

Overview

This strategy is a trend-following trading system based on price fractal theory, which identifies market fractal structures and combines fixed-point trigger conditions with take-profit settings for automated trading. The core strategy involves setting long entry points above bottom fractals and short entry points below top fractals, along with corresponding take-profit levels for risk control.

Strategy Principles

The core logic includes the following key steps:

  1. Fractal Identification: Identifies top and bottom fractals by comparing three consecutive candlesticks. A bottom fractal forms when the middle candlestick's low is lower than its adjacent ones; a top fractal forms when the middle candlestick's high is higher than its adjacent ones.
  2. Entry Conditions: Sets buy trigger price 107 pips above identified bottom fractals; sets sell trigger price 107 pips below identified top fractals.
  3. Take Profit Setup: Places take-profit levels 107 pips from entry price.
  4. Position Management: Continuously tracks the latest fractal positions and updates entry trigger prices accordingly.

Strategy Advantages

  1. Objectivity: Uses clear mathematical definitions to identify market structure, avoiding subjective judgment bias.
  2. Risk Control: Employs fixed-point take-profit settings for clear profit targets and controllable risk.
  3. Adaptability: Can operate in various market environments, particularly suitable for highly volatile markets.
  4. High Automation: The entire trading process from signal identification to execution is automated, reducing human intervention.

Strategy Risks

  1. False Breakout Risk: Markets may quickly reverse after short-term breakouts, triggering stop losses.
  2. Choppy Market Risk: Frequent top and bottom fractals in ranging markets may generate excessive trading signals.
  3. Fixed Point Risk: Using fixed entry and take-profit points may not suit all market conditions.
  4. Slippage Risk: May face significant slippage issues in highly volatile markets.

Strategy Optimization

  1. Dynamic Point Optimization: Adjust entry trigger and take-profit points based on market volatility.
  2. Trend Filtering: Add trend identification indicators to trade only in the primary trend direction.
  3. Market Environment Recognition: Implement market state identification mechanisms to use different parameters in different market conditions.
  4. Position Management Optimization: Introduce dynamic position sizing based on account equity and market risk levels.

Summary

This strategy combines fractal theory with momentum breakout concepts to build a complete trading system. Its strengths lie in objectivity and high automation, though it faces some market adaptability challenges. Through optimization measures like dynamic parameter adjustment and market environment recognition, the strategy's stability and profitability can be further enhanced. In live trading, investors should adjust parameters based on their risk tolerance and capital size.

Source Pine Script

/*backtest
start: 2019-12-23 08:00:00
end: 2024-12-09 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("Fractal Buy/Sell Strategy with 107 Pips Target", overlay=true)

// Input Parameters
trigger_pips = input.int(107, title="Entry Distance (Pips)")  // The distance between the entry point and the bottom fractal or top fractal
take_profit_pips = input.int(107, title="Take Profit (Pips)") // Take-profit points

pip_value = syminfo.mintick * 10 // Point value (how much price unit each point equals))

// Calculate fractal
is_bottom_fractal = low[1] < low[2] and low[1] < low[0] // Determine whether it is a bottom fractal
is_top_fractal = high[1] > high[2] and high[1] > high[0] // Determine whether it is a top fractal

// Store fractal positions
var float last_bottom_fractal = na
var float last_top_fractal = na

// Update fractal value
if is_bottom_fractal
    last_bottom_fractal := low[1]
    
if is_top_fractal
    last_top_fractal := high[1]

// Calculate opening price
bottom_trigger_price = na(last_bottom_fractal) ? na : last_bottom_fractal + trigger_pips * pip_value
top_trigger_price = na(last_top_fractal) ? na : last_top_fractal - trigger_pips * pip_value

// Trading logic: long positions at bottom fractals and short positions at top fractals
if not na(last_bottom_fractal)
    if close <= bottom_trigger_price
        strategy.entry("Buy", strategy.long)
        strategy.exit("Take Profit", from_entry="Buy", limit=bottom_trigger_price + take_profit_pips * pip_value)
        
if not na(last_top_fractal)
    if close >= top_trigger_price
        strategy.entry("Sell", strategy.short)
        strategy.exit("Take Profit", from_entry="Sell", limit=top_trigger_price - take_profit_pips * pip_value)

// Draw types and trigger prices
plotshape(series=is_bottom_fractal, style=shape.triangleup, location=location.belowbar, color=color.green, title="Bottom Fractal")
plotshape(series=is_top_fractal, style=shape.triangledown, location=location.abovebar, color=color.red, title="Top Fractal")
plot(bottom_trigger_price, title="Buy Trigger", color=color.green, linewidth=1)
plot(top_trigger_price, title="Sell Trigger", color=color.red, linewidth=1)

Published by ChaoZhang on the FMZ strategy square · last modified 2024-12-11. 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/Fractal-Breakout-Momentum-Trading-Strategy-with-Take-Profit-Optimization.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