Type/to search

Dynamic Moving Average Tracking Strategy

Common strategy
Created: 2023-11-24 16:59:25
Last modified: 3 years ago
1
Follow
1802
Followers

img

Overview

The core idea of this strategy is to use dynamic moving average for trend tracking, set stop loss and take profit, and combine Heikin Ashi candlestick techniques for long/short signal judgment. ATR indicator is used to calculate the dynamic moving average and stop loss position.

Principles

The strategy first calculates the ATR indicator, then combines the input price source and parameters to compute the dynamic moving average. Long/short signals are generated when price crosses above/below the dynamic moving average. Meanwhile, stop loss and take profit positions are set to track price changes in real time.

Specifically, ATR indicator and parameter nLoss are calculated first. Then current period's price and previous period's stop loss position are compared to update the stop loss line. When price breaks through previous period's stop loss line, long/short signals pos and corresponding colors are generated. When trading signals are triggered, arrow markings are plotted. Finally positions are closed based on stop loss/take profit logic.

Advantage Analysis

The biggest advantage of this strategy is the use of dynamic moving average to track price changes in real time. This captures trends better than traditional fixed moving averages and reduces chances of stop loss. Additionally, combining ATR based stop loss allows flexible adjustment of stop loss position based on market volatility to effectively control risks.

Risks and Solutions

The main risk of this strategy is that price may gap up/down significantly, causing false signals when stop loss is hit. Also, improper condition settings may lead to overly frequent trading.

Solutions include optimizing moving average period, adjusting ATR and stop loss coefficient to lower probability of false signals. Additional filters can be added to avoid overly dense trades.

Optimization Directions

The strategy can be optimized in the following aspects:

  1. Test different types and periods of moving averages to find optimal parameter combinations

  2. Optimize ATR period parameter to balance stop loss sensitivity

  3. Add extra filters and indicators to improve signal quality

  4. Adjust stop loss/take profit values to optimize risk reward ratio

Conclusion

The core idea of this strategy is to use dynamic moving average to track price changes in real time, utilizing ATR indicator to dynamically set stop loss positions, controlling risk strictly while tracking trends. Through parameter optimization and rule refinement, this strategy can be tuned into a highly practical quantitative system.

Source
Pine
/*backtest
start: 2022-11-23 00:00:00
end: 2023-11-05 05:20:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Binance","currency":"BTC_USDT","stocks":0}]
*/

//@version=5
strategy(title='UT Bot v5', overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
//CREDITS to HPotter for the orginal code. The guy trying to sell this as his own is a scammer lol. 
//Edited and converted to @version=5 by SeaSide420 for Paperina
Strategy parameters
Strategy parameters
Allow Buy?
Allow Sell?
Signals from Heikin Ashi Candles
Price Source (recommended OPEN to avoid repainting)
Moving Average Type
This changes the MAPeriod
This changes the sensitivity
ATR Period
Take Profit ($)
Stop Loss ($)
Comment
All comments (0)
No data
No data
  • 1
Forums
PINE Language
Get the app
iPhone Download
© 2015 - ∞ INVENTOR PTE LTD (SG)