0bps

Strategy vault / Breakout

24 Hour Volume Price Fibonacci Retracement MA Cross Trading Strategy

This strategy is a quantitative trading system based on 24-hour trading volume, price highs and lows, and Fibonacci retracement levels. The strategy determines trading opportunities by combining crossover signals…

Author
ianzeng123
Complexity
Starter · 51 lines
Parameters
0
Backtest bar
1d · swing
Tested on
SOL/USDT · spot

IMG IMG

Overview

This strategy is a quantitative trading system based on 24-hour trading volume, price highs and lows, and Fibonacci retracement levels. The strategy determines trading opportunities by combining crossover signals from short-term and long-term moving averages while using volume and Fibonacci levels to validate price trend validity. This multi-dimensional indicator combination can both capture market trends and execute trades at key support and resistance levels.

Strategy Principles

The core logic of the strategy includes the following key elements:

  1. 24-Hour Price Range Tracking: The system continuously monitors and updates the highest and lowest prices within each trading day to establish the price fluctuation range.
  2. Fibonacci Retracement Calculation: Calculates four key Fibonacci retracement levels (23.6%, 38.2%, 61.8%, and 78.6%) based on intraday highs and lows.
  3. Volume Analysis: Uses a 20-period Simple Moving Average (SMA) to smooth volume data and reflect market activity.
  4. Moving Average Crossover Signals: Generates trading signals through crossovers of 14-period and 28-period moving averages, where crossing above indicates a long signal and crossing below indicates a short signal.

Strategy Advantages

  1. Multi-dimensional Analysis: Combines price, volume, and technical indicators for a more comprehensive market perspective.
  2. Strong Adaptability: Fibonacci levels are calculated based on real-time price ranges, allowing dynamic adaptation to market changes.
  3. Reasonable Risk Control: Multiple indicator confirmation reduces risks from false breakouts.
  4. Clear Operational Logic: Entry signals are explicit, making execution and backtesting straightforward.
  5. Optimized Time Period: 24-hour monitoring suits markets that trade around the clock.

Strategy Risks

  1. Choppy Market Risk: Moving average crossover signals may generate frequent trades in sideways markets.
  2. Lag Issues: Moving average indicators have inherent lag, potentially missing optimal entry points.
  3. False Breakout Risk: Price breakouts during low liquidity periods may lack genuine volume support.
  4. Computational Complexity: Real-time calculation of multiple indicators may increase system load.

Strategy Optimization Directions

  1. Dynamic Parameter Optimization:
  • Automatically adjust moving average periods based on market volatility
  • Optimize volume moving average period to improve sensitivity to market activity
  1. Signal Filter Enhancement:
  • Add trend strength confirmation indicators
  • Introduce volatility filters to avoid trading in low volatility environments
  1. Risk Management Improvement:
  • Implement dynamic stop-loss mechanisms
  • Add position sizing algorithms

Summary

The strategy constructs a logically complete trading system by comprehensively utilizing 24-hour price ranges, Fibonacci retracement levels, volume, and moving average crossovers. The strategy's main advantages lie in its multi-dimensional analysis and adaptability, but attention must be paid to risks such as choppy markets and false breakouts. Through the suggested optimization directions, the strategy's stability and profitability potential can be further enhanced.

Source Pine Script

/*backtest
start: 2024-02-25 00:00:00
end: 2025-02-22 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Binance","currency":"SOL_USDT"}]
*/

//@version=5
strategy("24-Hour Volume and Fibonacci Levels Strategy", overlay=true)

// Define the 24-hour time period
startTime = timestamp(year, month, dayofmonth, 0, 0)
endTime = timestamp(year, month, dayofmonth, 23, 59)

// Calculate 24-hour high and low
var float dayHigh = na
var float dayLow = na

if (time >= startTime and time <= endTime)
    dayHigh := na(dayHigh) ? high : math.max(dayHigh, high)
    dayLow := na(dayLow) ? low : math.min(dayLow, low)

// Fibonacci levels
fibRetrace1 = dayLow + (dayHigh - dayLow) * 0.236
fibRetrace2 = dayLow + (dayHigh - dayLow) * 0.382
fibRetrace3 = dayLow + (dayHigh - dayLow) * 0.618
fibRetrace4 = dayLow + (dayHigh - dayLow) * 0.786

// Plot Fibonacci levels
plot(fibRetrace1, color=color.green, linewidth=2, title="Fibonacci 23.6%")
plot(fibRetrace2, color=color.blue, linewidth=2, title="Fibonacci 38.2%")
plot(fibRetrace3, color=color.orange, linewidth=2, title="Fibonacci 61.8%")
plot(fibRetrace4, color=color.red, linewidth=2, title="Fibonacci 78.6%")

// Volume Indicator
volumeMa = ta.sma(volume, 20)
plot(volumeMa, color=color.purple, title="24-Hour Volume", linewidth=2)

// Optional: Display the 24-hour volume on the chart
bgcolor(time >= startTime and time <= endTime ? color.new(color.purple, 90) : na)

// Strategy conditions (based on moving averages)
longCondition = ta.crossover(ta.sma(close, 14), ta.sma(close, 28))
if (longCondition)
    strategy.entry("My Long Entry Id", strategy.long)

shortCondition = ta.crossunder(ta.sma(close, 14), ta.sma(close, 28))
if (shortCondition)
    strategy.entry("My Short Entry Id", strategy.short)

Published by ianzeng123 on the FMZ strategy square · last modified 2025-02-24. 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/24-Hour-Volume-Price-Fibonacci-Retracement-MA-Cross-Trading-Strategy.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