Type/to search

Polygon Moving Average Strategy

Cryptocurrency
Created: 2023-10-31 14:53:50
Last modified: 3 years ago
1
Follow
1779
Followers

img

Overview

The Polygon Moving Average strategy constructs a polygon with multiple moving averages of different periods and uses the breakthrough of the polygon as trading signals. This trend-following strategy incorporates multiple timeframes and can effectively filter market noise and capture the main trend.

Strategy Logic

The strategy plots several EMAs, such as 3-period, 7-period and 13-period EMAs, to form a polygon channel. When the price breaks above the EMAs, a long signal is generated. When the price breaks below the EMAs, a short signal is generated. This helps avoid many false breakouts.

The code determines the breakthrough signals by comparing the close price to the EMAs using conditions like close>ema1 and ema1>ema2 and ema2>ema3. The time condition time_cond is added to limit the backtest period. The strategy uses a trailing stop loss to protect profits after entry.

Advantages

The biggest advantage of this strategy is its ability to effectively capture the main trend direction by using multiple moving averages as filters to avoid noise. The trailing stop loss takes profits in a timely manner.

Risks and Solutions

The main risk is that this strategy fails to identify trend reversal points and may lead to loss during trend reversals. Inappropriate MA period settings may also result in overtrading or lagging signals. The risks can be reduced by optimizing MA combinations, adding reversal indicators, widening stop loss range, etc.

Optimization Directions

The strategy can be optimized in the following aspects:

  1. Optimize the MA periods to find the best combination.

  2. Add reversal indicators like RSI and MACD to exit trades timely.

  3. Optimize the stop loss range and offset to reduce premature stop loss.

  4. Optimize parameters for different products to improve adaptability.

Summary

The Polygon Moving Average strategy is generally a reliable and effective trend following system. Its biggest strength is capturing the main trend while filtering out noise significantly. But it has some limitations in identifying reversals. We can improve it by parameter optimization, adding auxiliary indicators, etc. It is suitable for markets with obvious trends and can generate stable profits if used properly.

Source
Pine
/*backtest
start: 2023-09-30 00:00:00
end: 2023-10-30 00:00:00
period: 1h
basePeriod: 15m
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/
// © Crypto-Oli

//@version=4
Strategy parameters
Strategy parameters
From Day
From Month
From Year
To Day
To Month
To Year
v_input_7
v_input_8
v_input_9
Comment
All comments (0)
No data
No data
  • 1
iPhone Download
Forums
PINE Language
© 2015 - ∞ INVENTOR PTE LTD (SG)