0bps

Strategy vault / Breakout

Large Volatility Breakout Dual Direction Trading Strategy Point Based Threshold Entry System

This strategy is a dual-direction trading system based on 30-minute candles, seeking trading opportunities through price volatility monitoring. The core mechanism involves identifying significant price movements…

Author
ChaoZhang
Complexity
Intermediate · 102 lines
Parameters
0
Backtest bar
1h · intraday
Tested on
BTC/USDT · futures

IMG

Overview

This strategy is a dual-direction trading system based on 30-minute candles, seeking trading opportunities through price volatility monitoring. The core mechanism involves identifying significant price movements using point thresholds and executing trades upon breakout confirmation. The strategy incorporates strict time management, stop-loss/take-profit mechanisms, and trade management protocols for controlled automated trading.

Strategy Principle

The strategy employs multiple filtering mechanisms to identify valid trading signals. It calculates the volatility range of each 30-minute candle at close, marking potential trading opportunities when the range exceeds preset thresholds. To ensure signal validity, the strategy implements additional buffer points, triggering actual trade signals only when prices break through this buffer zone. The system enables both long and short positions, entering longs on upward breakouts and shorts on downward breakouts, with corresponding profit targets and stop-loss levels.

Strategy Advantages

  1. Comprehensive time management: Limited trading windows avoid false signals during inactive periods
  2. Dual-direction trading: Captures opportunities in both market directions, improving capital efficiency
  3. Robust risk control: Fixed-point stop-loss and take-profit levels facilitate risk assessment and management
  4. High automation: Fully automated from signal identification to trade execution, minimizing human intervention
  5. Flexible parameter settings: Adjustable key parameters adapt to different market conditions

Strategy Risks

  1. False breakout risk: Large volatility may lead to false breakouts resulting in stop-loss exits
  2. Parameter sensitivity: Improper threshold settings may cause missed opportunities or overtrading
  3. Market environment dependency: May trigger frequent stop-losses in ranging markets
  4. Slippage impact: Actual execution prices may significantly deviate from signal prices during high volatility
  5. Capital management risk: Lack of position sizing mechanisms may lead to excessive risk exposure

Strategy Optimization Directions

  1. Add trend filtering: Incorporate longer-term trend indicators to improve signal quality
  2. Dynamic parameter optimization: Automatically adjust thresholds and stop-loss parameters based on market volatility
  3. Volume confirmation: Add volume filtering conditions to enhance breakout reliability
  4. Optimize stop-loss/take-profit: Implement dynamic exits adapting to different market conditions
  5. Incorporate position sizing: Dynamically adjust position sizes based on signal strength and market volatility

Conclusion

This is a comprehensively designed automated trading strategy with clear logic. Through strict condition filtering and risk control, the strategy demonstrates practical applicability. However, thorough testing and optimization in live trading are necessary, particularly in parameter settings and risk control aspects which need adjustment based on actual market conditions. Successful strategy implementation requires stable market conditions and appropriate parameter configuration, with recommended extensive backtesting before live deployment.

Source Pine Script

/*backtest
start: 2024-10-01 00:00:00
end: 2024-10-31 23:59:59
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("Big Candle Breakout Strategy Both Side", overlay=true)  

// Input for the point move threshold
point_move_in = input.int(100, title="Point Move Threshold")
point_target = input.int(100, title="Point Target")
point_stoploss = input.int(100, title="Point Stop Loss")
point_buffer = input.int(5, title="Point Buffer")

point_move = point_buffer + point_move_in

// Define the start and end times for trading
start_hour = 9
start_minute = 15
end_hour = 14
end_minute = 30

// Function to check if the current time is within the allowed trading window
in_time_range = (hour(time('30')) > start_hour or (hour(time('30')) == start_hour and minute(time('30')) >= start_minute)) and (hour(time('30')) < end_hour or (hour(time('30')) == end_hour and minute(time('30')) <= end_minute))

// Retrieve the open, high, low, and close prices of 30-minute candles
open_30m = request.security(syminfo.tickerid, "30", open)
high_30m = request.security(syminfo.tickerid, "30", high)
low_30m = request.security(syminfo.tickerid, "30", low)
close_30m = request.security(syminfo.tickerid, "30", close)

// Calculate the range of the candle
candle_range_long = (close_30m - open_30m)
candle_range_short = (open_30m - close_30m)

// Determine if the candle meets the criteria to be marked
big_candle_long = candle_range_long >= point_move_in
big_candle_short = candle_range_short >= point_move_in

// Variables to store the state of the trade
var float long_entry_price = na
var float long_target_price = na
var float long_stop_loss_price = na

var float short_entry_price = na
var float short_target_price = na
var float short_stop_loss_price = na

// Check if there are no active trades
no_active_trades = (strategy.opentrades == 0)

// Long entry condition
if (big_candle_long and na(long_entry_price) and in_time_range and no_active_trades)
    long_entry_price := high_30m+point_buffer
    long_target_price := long_entry_price + point_target
    long_stop_loss_price := long_entry_price - point_stoploss
    strategy.entry("Buy", strategy.long, stop=long_entry_price, limit=long_target_price)

plot(long_entry_price, style=plot.style_linebr, color=color.blue, linewidth=2, title="Entry Price")
plot(long_target_price, style=plot.style_linebr, color=color.green, linewidth=2, title="Target Price")
plot(long_stop_loss_price, style=plot.style_linebr, color=color.red, linewidth=2, title="Stop Loss Price")

// Short entry condition
if (big_candle_short and na(short_entry_price) and in_time_range and no_active_trades)
    short_entry_price := low_30m - point_buffer
    short_target_price := short_entry_price - point_target
    short_stop_loss_price := short_entry_price + point_stoploss
    strategy.entry("Sell", strategy.short, stop=short_entry_price, limit=short_target_price)

plot(short_entry_price, style=plot.style_linebr, color=color.blue, linewidth=2, title="Short Entry Price")
plot(short_target_price, style=plot.style_linebr, color=color.green, linewidth=2, title="Short Target Price")
plot(short_stop_loss_price, style=plot.style_linebr, color=color.red, linewidth=2, title="Short Stop Loss Price") 

// Long exit conditions
if (not na(long_entry_price))
    strategy.exit("Long Exit", from_entry="Buy", limit=long_target_price, stop=long_stop_loss_price)
   
// Short exit conditions
if (not na(short_entry_price))
    strategy.exit("Short Exit", from_entry="Sell", limit=short_target_price, stop=short_stop_loss_price)

// Reset trade status
if (strategy.position_size == 0)
    long_entry_price := na
    long_target_price := na
    long_stop_loss_price := na

    short_entry_price := na
    short_target_price := na
    short_stop_loss_price := na

// Plot the big candle and entry/exit levels
plotshape(series=big_candle_long, location=location.abovebar, style=shape.circle, color=color.green)
plotshape(series=big_candle_short, location=location.abovebar, style=shape.circle, color=color.red)

//plot(long_entry_price, style=plot.style_stepline, color=color.blue, linewidth=2, title="Entry Price")
//plot(long_target_price, style=plot.style_stepline, color=color.green, linewidth=2, title="Target Price")
//plot(long_stop_loss_price, style=plot.style_stepline, color=color.red, linewidth=2, title="Stop Loss Price")

Published by ChaoZhang on the FMZ strategy square · last modified 2024-11-18. 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/Large-Volatility-Breakout-Dual-Direction-Trading-Strategy-Point-Based-Threshold-Entry-System.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