Type/to search

Grid Strategy with Moving Average Lines

Cryptocurrency
Created: 2023-12-20 13:55:15
Last modified: 2 years ago
1
Follow
1779
Followers

img

Overview

This is a grid trading strategy that utilizes moving average lines dynamically. It draws multiple buy and sell zones above and below the moving average line based on settings of the MA and volatility range. When price drops into different buy zones, corresponding long orders will be opened. When price goes back into sell zones, opened orders will be closed sequentially. Thus forms a dynamic grid trading mechanism.

Strategy Logic

  1. Users set parameters for determining major moving average line;
  2. Multiple buy and sell zones are divided based on ATR and settings;
  3. When price drops into different buying zones, corresponding long orders are triggered;
  4. When price moves back into sell zones, orders are closed sequentially;
  5. A dynamic grid trading system is formed eventually.

Advantages

  1. Using MA line to determine trend direction avoids trading against major trend;
  2. ATR parameter considers market volatility, making grid more dynamic;
  3. Opening orders in batches controls risks;
  4. Closing orders sequentially avoids cascade stop loss;
  5. Simple parameters, easy to operate.

Risks

  1. Significant fluctuation may frequently trigger grid losses;
  2. In strong trends, stop loss points could be too close leading to quick post-pullback stops;
  3. Increased transactions from multiple entries produce higher commission fees;
  4. Not suitable for range-bound or trendless markets.

Risks can be reduced by relaxing grid interval, optimizing ATR parameter, reducing order quantities etc. Different parameter sets could also be used for trending and ranging scenarios.

Optimization Directions

  1. Spot index indicators can be added to determine bullish/bearish bias;
  2. Quantitative indicators can be used to select assets with trend characteristics;
  3. ATR parameters or grid intervals can be adjusted dynamically based on volatility;
  4. Profit taking mechanism can be added to follow trends.

These further optimizations will make the strategy more dynamic and locally enhanced.

Conclusion

In conclusion, this is an overall mature and simple trend-following grid strategy. It uses moving averages to determine major trends, and establishes dynamic grid mechanism for batched trades. Has certain risk control capabilities. With further quant optimizations, it can become a very practical quant tool.

Source
Pine
/*backtest
start: 2022-12-13 00:00:00
end: 2023-12-19 00:00:00
period: 1d
basePeriod: 1h
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/
// © Seungdori_

//@version=5
Strategy parameters
Strategy parameters
Grid Logic
MA
MA Length
MA Type
Parameter
Band Multiplier/Percent
parameter
ATR Length
Comment
All comments (0)
No data
No data
  • 1
iPhone Download
Forums
PINE Language
© 2015 - ∞ INVENTOR PTE LTD (SG)