Type/to search

Dynamic Price Channel with Stop Loss Tracking Strategy

Common strategy
Created: 2024-02-01 10:52:33
Last modified: 3 years ago
1
Follow
1802
Followers

img

Overview

This strategy is developed based on the Donchian price channel indicator. The indicator forms a price channel by calculating the highest and lowest prices over a certain period. The strategy utilizes the price channel to implement two-way trading and sets stop loss and take profit prices. The stop loss price is fixed to the middle line of the price channel, and the take profit price is set to a certain percentage beyond the upper and lower limits of the price channel. The strategy also implements tracking of stop loss and take profit.

Strategy Principle

Firstly, the strategy calculates the upper limit h and lower limit l of the price channel based on the parameter pclen. The middle line center is the average of the upper and lower limits of the price channel. Then, take profit prices tpl and tps are calculated according to the take profit parameters tp for long and short positions. The stop loss price is fixed to the middle line center of the price channel. When the price breaks through the price channel, trading positions of different directions are calculated according to the risk sizes risklong and riskshort. The strategy will close positions when the price re-enters the channel. In addition, time filtering is set to only trade within the specified date range.

The specific trading logic is:

Long entry signal: open long when price is greater than the channel upper limit h and falls back into the channel

Long exit signal: close long when price is lower than the channel middle line center (stop loss) or higher than take profit price tpl (take profit)

Short entry signal: open short when price is less than the channel lower limit l and falls back into the channel

Short exit signal: close short when price is higher than the channel middle line center (stop loss) or lower than take profit price tps (take profit)

Advantage Analysis

The advantages of this strategy are:

  1. Two-way trading can capture reversals of price trends
  2. Use price channel to determine trend direction and avoid false breakouts
  3. Set stop loss and take profit to control risks
  4. Calculate position size associated with risk size to achieve controllable risks
  5. Implement tracking of stop loss and take profit to lock in more profits

Risk Analysis

There are also some risks in this strategy:

  1. Improper parameter settings of price channel may lead to too high trading frequency or missing trading opportunities
  2. Stop loss price set too wide may increase risk exposure
  3. Tracking take profit may trigger prematurely in high volatility periods

These risks can be reduced and controlled by adjusting parameters and manual monitoring.

Optimization Directions

This strategy can also be optimized in the following aspects:

  1. Add more indicator filters to avoid frequent opening and closing in range-bound markets
  2. Different stop loss and take profit algorithms can be tested, such as ATR stop loss
  3. Expand to a cross-timeframe trading system using higher timeframe to determine trend direction
  4. Add position sizing module to adjust positions based on capital utilization ratio
  5. Incorporate machine learning models to judge the success rate of price breakouts to avoid false breakouts

Conclusion

In conclusion, this is an effective strategy to implement two-way trading using price channel indicators. With proper stop loss, take profit, and position sizing control modules, risks can be well controlled. With some optimizations and adjustments, it can become a powerful quantitative trading strategy.

Source
Pine
/*backtest
start: 2023-01-31 00:00:00
end: 2024-01-31 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//Noro
//2020

//@version=4
Strategy parameters
Strategy parameters
Long
Short
Take-profit, %
Take-profit type
Take-profit type
Risk size for long, %
Risk size for short, %
Price Channel Length
Show lines
Show Background
Show Offset
Show label
From Year
To Year
From Month
To Month
From day
To day
Comment
All comments (0)
No data
No data
  • 1
Forums
PINE Language
Get the app
iPhone Download
© 2015 - ∞ INVENTOR PTE LTD (SG)