Type/to search

Quantitative Candlestick Pattern and Trend Following Strategy

Common strategy
Created: 2024-01-31 17:24:30
Last modified: 3 years ago
1
Follow
1802
Followers

img

Overview

The strategy is named "Quantitative Candlestick Pattern and Trend Following Strategy". It integrates the strategy ideas of candlestick pattern analysis and trend following trading.

The strategy mainly identifies different candlestick patterns to judge the current market sentiment and potential turning points. Combined with tracking the highest and lowest prices to form entry and exit signals and capture mid-to-long term price trends.

Strategy Principle

The main modules of this strategy are:

  1. Candlestick Pattern Identification

    The strategy first defines elements on the candlestick like the body, shadow, and sets some parameters to identify over 40 common candlestick patterns like Doji, Morning Star, Three Inside Up, etc. When these patterns are identified, marks will be plotted and judged as bullish or bearish signals.

  2. Trend Identification

    The strategy utilizes the tracking of highest and lowest prices in N days to determine the trend. When price breaks above the highest price in N days, it is judged as an uptrend. When price breaks below the lowest price in N days, it is judged as a downtrend.

  3. Entry and Exit

    According to the bullish/bearish signals from candlestick pattern identification and the breakthrough of highest/lowest prices from trend identification, the strategy forms the entry and exit rules.

    For example, when a bullish pattern like Hammer is identified and price breaks above the N-day highest price, go long. When price breaks below the N-day lowest price, close the long position.

  4. Backtest Range Setting

    At last, the strategy sets the start and end time for backtest to complete the whole logical loop.

Advantage Analysis

The advantages of this strategy:

  1. Combination of Pattern and Trend

    Utilize both pattern identification and trend following, it can spot potential turning points through patterns and determine entry timing according to trends.

  2. Broad Pattern Coverage

    The strategy covers over 40 common candlestick patterns, which provides wider coverage in different market environments for more potential trading opportunities.

  3. High Parameter Tunability

    The parameters like tracking days, pattern identification parameters are adjustable for users. It has better adaptivity and easier to tune for specific markets.

  4. Easy to Expand

    It's easy to expand with more pattern identifications based on existing logic or add in more factors to further optimize the strategy performance.

Risk Analysis

The main risks of the strategy:

  1. Accuracy of Pattern Identification

    Candlestick pattern identification does not provide 100% accuracy, there are still probabilities of misidentification and wrong signal triggering.

  2. Lack of Stop Loss Module

    Currently there is no stop loss logic in the strategy, unable to control losses of single trades effectively. It may lead to huge losses when trend identification fails.

  3. Data Fitting Risk of Backtest

    The current good results may have some data fitting risks towards the backtest data. Real trading performance may see a decrease.

Optimization Directions

The main optimization directions:

  1. Add in Stop Loss Module

    Add in modules like moving stop loss, percentage stop loss etc. to effectively control risks and limit max loss per trade.

  2. Utilize Machine Learning to Improve Accuracy of Pattern Identification

    Use machine learning algorithms to train models and improve accuracy of candlestick pattern identification, decrease misidentified signals.

  3. Multi-Market Validation

    Test the robustness of strategy on more markets like forex, crypto to avoid data fitting risks on single backtest.

  4. Introduce More Factors

    Bring in more quant factors like volume-price indicators, money flow indicators to enrich strategy logic and improve stability.

Conclusion

Overall, this strategy combines candlestick pattern identification and trend following trading to spot potential turning points and capture price trends simultaneously to achieve alpha. There are ample optimization space from risk control, machine learning models to multi-factor models to make it more robust and valuable for actual trading.

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

//@version=3
strategy("Candle analysis & long/short strategy (HF) inspired by TurtleBC", shorttitle="TurtleBC-V.Troussel", overlay=true,initial_capital=1000)

//VARIABLES
Strategy parameters
Strategy parameters
Doji size
From Month
From Day
From Year
To Month
To Day
To Year
enter_fast
exit_fast
exit_fast_short
Comment
All comments (0)
No data
No data
  • 1
Forums
PINE Language
Get the app
iPhone Download
© 2015 - ∞ INVENTOR PTE LTD (SG)