Multi-Indicator Resonance Trend-Following Pivot Point Trading System

HEIKIN ASHI Pivot Points HA PH/PL
Created on: 2025-06-30 15:53:48 Modified on: 2025-06-30 15:53:48
Copy: 0 Number of hits: 279
avatar of ianzeng123 ianzeng123
2
Follow
319
Followers

 Multi-Indicator Resonance Trend-Following Pivot Point Trading System  Multi-Indicator Resonance Trend-Following Pivot Point Trading System

Overview

The Multi-Indicator Resonance Trend-Following Pivot Point Trading System is a quantitative trading strategy based on pivot point analysis and smoothed candlesticks. This strategy integrates Heikin Ashi candlestick technology with key price pivot point detection mechanisms to capture price trends by identifying important turning points in the market. The core of the strategy lies in the quantitative implementation of the “buy low, sell high” concept, which involves buying at low pivot points and selling at high pivot points, coupled with a comprehensive risk management mechanism to achieve stable operations in the automated trading process.

Strategy Principles

The technical core of this strategy is based on the following key elements:

  1. Heikin Ashi Smoothed Candlesticks: The strategy uses Heikin Ashi candlesticks instead of traditional candlesticks. This improved candlestick type smooths price fluctuations through special calculation methods, more clearly showing market trend directions and filtering short-term noise.

  2. Pivot Point Detection Mechanism: The strategy implements an advanced pivot point detection algorithm, precisely identifying key turning points in the market through parameterized “left” and “right” candle counts (default 10 and 5). When a low pivot point forms, the system generates a long signal; when a high pivot point forms, the system generates a short signal.

  3. Signal Visualization: At identified pivot points, the strategy clearly marks “long” and “short” signals through labels, allowing traders to intuitively understand market structure.

  4. Position Management: The strategy defaults to using 100% of account value for trading, but this can be adjusted through parameters.

  5. Risk Control System: Implements percentage-based take-profit and stop-loss mechanisms, with separate settings for long and short positions, and equipped with trailing take-profit functionality to lock in profits. Default take-profit is set at 0.35% and stop-loss at 5% for both long and short positions.

  6. Reverse Signal Processing: When a short signal appears while holding a long position, or a long signal appears while holding a short position, the strategy automatically closes the existing position and opens a reverse position, achieving rapid market adaptation.

Strategy Advantages

  1. Noise Filtering: The adoption of Heikin Ashi technology effectively filters market noise, reduces false signals, and improves trend identification accuracy.

  2. Precise Capturing of Turning Points: Through the parameterized pivot point detection algorithm, the strategy can precisely identify key turning points in the market, realizing the “buy low, sell high” trading concept.

  3. Strong Adaptability: The strategy can automatically adjust trading direction according to market turning points, adapting to various market environments.

  4. Comprehensive Risk Management: Built-in multi-level risk control mechanisms, including fixed proportion stop-loss and dynamic trailing take-profit, effectively control single-trade risk.

  5. Highly Customizable: Key parameters of the strategy (such as pivot detection parameters, take-profit and stop-loss ratios, trailing take-profit offset, etc.) can be customized according to trader preferences and market characteristics.

  6. Visual Intuitiveness: By marking trading signals on the chart, the trading decision process becomes visually clear, easy to understand, and verify.

  7. Fully Automated Operation: From signal generation to position management to risk control, the entire trading process is fully automated, reducing human intervention and emotional influence.

Strategy Risks

  1. Delayed Confirmation: The pivot point detection mechanism has inherent delay (determined by the “right” parameter, default 5 candles), meaning signals may be confirmed after missing part of the price movement.

  2. Fixed Stop-Loss Limitations: Using a fixed percentage stop-loss may not fully adapt to the volatility characteristics of different markets, potentially being too small in high-volatility markets or too large in low-volatility markets.

  3. Excessive Reversal Trading: In oscillating markets, pivot points may form frequently, causing the system to overtrade and increase trading costs.

  4. Heikin Ashi Limitations: While Heikin Ashi helps identify trends, it can also mask certain price details, potentially causing important signals to be missed in certain market conditions.

  5. Fixed Parameter Risk: The strategy uses fixed pivot point detection parameters, which may not be applicable to all time periods or all market conditions.

  6. Lack of Market Environment Filtering: The strategy does not have a built-in market environment judgment mechanism and may perform poorly in oscillating markets unsuitable for trend following.

  7. Commission Impact: High-frequency trading strategies are sensitive to trading costs, and commission impact needs to be fully considered in practical applications.

Strategy Optimization Directions

  1. Adaptive Parameters: Introduce volatility indicators (such as ATR) to dynamically adjust pivot point detection parameters and take-profit/stop-loss ratios based on market volatility, improving strategy adaptability.

  2. Market Environment Filtering: Add market environment judgment mechanisms, such as trend strength indicators or volatility indicators, to pause trading under unsuitable market conditions.

  3. Multi-Timeframe Confirmation: Introduce multi-timeframe analysis, requiring trading signals to be supported by higher timeframe trends, reducing counter-trend trading.

  4. Volume Confirmation: Integrate volume analysis, requiring signals to be executed only with sufficient volume support, improving signal quality.

  5. Dynamic Position Management: Implement dynamic position management based on market volatility and account risk, replacing the existing fixed percentage method.

  6. Machine Learning Optimization: Use machine learning methods to optimize strategy parameters, such as automatically adjusting left and right candle counts based on historical data, improving strategy stability.

  7. Add Signal Filters: Introduce additional technical indicators as signal filters, such as RSI, MACD, etc., executing trades only when confirmed by multiple indicator resonance.

  8. Time Filtering: Add trading time filtering to avoid periods of excessive or insufficient volatility, improving trading efficiency.

Summary

The Multi-Indicator Resonance Trend-Following Pivot Point Trading System is a quantitative trading strategy that combines Heikin Ashi technology with pivot point analysis, realizing the “buy low, sell high” trading concept through precise identification of market turning points. This strategy has advantages such as noise filtering, clear signals, and comprehensive risk management, but also faces limitations such as signal delay and fixed parameters.

By introducing adaptive parameter mechanisms, multiple signal confirmations, market environment filtering, and other optimization means, this strategy has the potential to further improve trading efficiency and stability. The core value of the strategy lies in combining the pivot point theory from traditional technical analysis with modern quantitative trading technology, providing traders with a systematic, disciplined trading method that effectively reduces emotional interference and improves trading consistency.

For traders hoping to achieve automated “buy low, sell high” in the market, this strategy provides a good starting point. Through reasonable parameter adjustments and continuous optimization, it can adapt to different market environments and trading needs, achieving long-term stable trading performance.

Strategy source code
/*backtest
start: 2024-06-30 00:00:00
end: 2025-06-28 08:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"ETH_USDT"}]
*/

//@version=5
strategy(title="ZYTX GKDD", shorttitle="ZYTX GKDD", overlay=true, 
  pyramiding=1, default_qty_type=strategy.percent_of_equity, default_qty_value=100, 
  commission_type=strategy.commission.percent, commission_value=0.03)

// ===== 策略参数 =====
// --- 枢轴点检测参数 ---
string g1 = "智赢天下策略机器人"
leftBars = input.int(10, title="线上", minval=1, group=g1)
rightBars = input.int(5, title="线下", minval=1, group=g1)

// --- 多空开关 ---
string g2 = "策略开关"
enableLong = input.bool(true, "启用多单策略", group=g2)  // 启用多单
enableShort = input.bool(true, "启用空单策略", group=g2)  // 启用空单

// ==== 止盈止损设置 ====
string g3 = "风险控制"
SS = input.bool(true, "用百分比止损", group=g3)
yy = input.int(100, "止盈止损仓位比例", minval=1, maxval=100, group=g3)
jj = input.float(10, "移动止盈止损偏移", minval=0.1, step=0.1, group=g3)

longProfitPerc = input.float(0.35, "多单止盈(%)", minval=0.0, step=0.1, group=g3) * 0.01
shortProfitPerc = input.float(0.35, "空单止盈(%)", minval=0.0, step=0.1, group=g3) * 0.01
longLossPerc = input.float(5, "多单止损(%)", minval=0.0, step=0.1, group=g3) * 0.01
shortLossPerc = input.float(5, "空单止损(%)", minval=0.0, step=0.1, group=g3) * 0.01

// ==== 计算Heikin Ashi数据 ====
ha_ticker = ticker.heikinashi(syminfo.tickerid)
[ha_open, ha_high, ha_low, ha_close] = request.security(ha_ticker, timeframe.period, 
  [open, high, low, close], lookahead=barmerge.lookahead_off)

// ==== 枢轴点检测 ====
pivotHighValue = ta.pivothigh(ha_high, leftBars, rightBars)
pivotLowValue = ta.pivotlow(ha_low, leftBars, rightBars)

// ==== 固定标签样式 ====
color high_label_color = color.red
color low_label_color = color.green
color text_color = color.white
string label_size = size.normal

string high_style = label.style_label_down
string low_style = label.style_label_up

// ==== 绘制枢轴点标签 ====
if not na(pivotHighValue)
    label.new(
         bar_index[rightBars], 
         ha_high[rightBars] * 1.002,
         text="空", 
         color=high_label_color, 
         textcolor=text_color, 
         style=high_style, 
         yloc=yloc.price, 
         size=label_size
     )
if not na(pivotLowValue)
    label.new(
         bar_index[rightBars], 
         ha_low[rightBars] * 0.998,
         text="多", 
         color=low_label_color, 
         textcolor=text_color, 
         style=low_style, 
         yloc=yloc.price, 
         size=label_size
     )

// ==== 交易信号 ====
// 出现"多"字标签时开多单
longSignal = not na(pivotLowValue) and enableLong
// 出现"空"字标签时开空单
shortSignal = not na(pivotHighValue) and enableShort

// ==== 交易状态跟踪 ====
var float entryPrice = na  // 入场价格
var float targetPrice = na  // 目标止盈价格
var float stopPrice = na  // 止损价格
var bool inLongPosition = false  // 是否持有多单
var bool inShortPosition = false  // 是否持有空单

// ==== 策略逻辑 ====
// 使用下一根K线的开盘价作为实际入场价格
if (longSignal and not inLongPosition and not inShortPosition)
    entryPrice := open
    targetPrice := entryPrice * (1 + longProfitPerc)
    stopPrice := entryPrice * (1 - longLossPerc)
    strategy.entry("多单入场", strategy.long, limit=entryPrice)  // 开多单
    inLongPosition := true
    inShortPosition := false

if (shortSignal and not inShortPosition and not inLongPosition)
    entryPrice := open
    targetPrice := entryPrice * (1 - shortProfitPerc)
    stopPrice := entryPrice * (1 + shortLossPerc)
    strategy.entry("空单入场", strategy.short, limit=entryPrice)  // 开空单
    inLongPosition := false
    inShortPosition := true

// 反向信号处理 - 平仓并开反向单
if (inLongPosition and shortSignal)
    strategy.close("多单入场", comment="反向信号平仓")
    inLongPosition := false
    entryPrice := open
    targetPrice := entryPrice * (1 - shortProfitPerc)
    stopPrice := entryPrice * (1 + shortLossPerc)
    strategy.entry("空单入场", strategy.short, limit=entryPrice)  // 反向开空单
    inShortPosition := true

if (inShortPosition and longSignal)
    strategy.close("空单入场", comment="反向信号平仓")
    inShortPosition := false
    entryPrice := open
    targetPrice := entryPrice * (1 + longProfitPerc)
    stopPrice := entryPrice * (1 - longLossPerc)
    strategy.entry("多单入场", strategy.long, limit=entryPrice)  // 反向开多单
    inLongPosition := true

// 止盈止损逻辑 - 使用if语句手动检查
if (inLongPosition and SS)
    // 更新移动止盈价格
    if ha_high > targetPrice
        targetPrice := ha_high - jj
        
    // 检查是否达到止盈条件
    if ha_high >= targetPrice
        strategy.close("多单入场", comment="多单止盈")
        inLongPosition := false
        
    // 检查是否达到止损条件
    if ha_low <= stopPrice
        strategy.close("多单入场", comment="多单止损")
        inLongPosition := false

if (inShortPosition and SS)
    // 更新移动止盈价格
    if ha_low < targetPrice
        targetPrice := ha_low + jj
        
    // 检查是否达到止盈条件
    if ha_low <= targetPrice
        strategy.close("空单入场", comment="空单止盈")
        inShortPosition := false
        
    // 检查是否达到止损条件
    if ha_high >= stopPrice
        strategy.close("空单入场", comment="空单止损")
        inShortPosition := false