Type/to search

Multi-Bar Direction Strategy

Cryptocurrency
Created: 2023-10-18 12:20:59
Last modified: 3 years ago
1
Follow
1781
Followers

img

Overview

The Multi-Bar Direction strategy identifies trend reversal signals by calculating the probability of multiple bars moving in the same direction. It is mainly used for medium-term trading.

Strategy Logic

The strategy first sets the start and end time for historical data extraction. The trading hours are configured to identify qualified candlesticks. It calculates the probability of consecutive ups or downs within 2 to 7 candlesticks. Trading signals are generated when the up or down ratio exceeds a threshold.

For example, if the probability of downtrend in 3 candlesticks is lower than 50%, the current 3 candlesticks meet the condition and a buy signal is generated. The parameters from 2 to 7 bars can be configured.

The specific logic is as follows:

  1. Set backtest time range, including start date, end date, trading hours.

  2. Count the number of same direction ups or downs within 2 to 7 candlesticks.

  3. Calculate the probability of continuation of up or down between adjacent candlesticks.

  4. If the probability is lower than 50%, the current candlesticks match the reversal pattern.

  5. Generate buy or sell signals within trading hours.

  6. Backtest to validate the strategy.

Advantages

  • Avoid false signals by considering multiple candlesticks probabilities.

  • Customizable bar count to identify reversal signals across different timeframes.

  • Clear trading hours avoid untimely signals.

  • Intuitive statistics display for performance evaluation.

  • Many optimizable parameters suitable for different markets.

Risks

  • Bar count cannot fully determine trend reversal points. There are misjudgements.

  • Long statistics duration may miss short-term trading opportunities.

  • Static threshold is impacted by market volatility. Dynamic adjustment is needed.

  • Backtest period selection may cause overfitting.

Possible solutions:

  1. Optimize bar count for different timeframes.

  2. Incorporate other indicators.

  3. Adopt dynamic thresholds based on market volatility.

  4. Expand backtest period and run multiple backtests.

Optimization Directions

The strategy can be optimized in the following aspects:

  1. Optimize bar count from 2 to 10 and select the optimal parameter.

  2. Test reversal threshold from 40% to 60% considering market changes.

  3. Add stop loss after signal generation to limit risk.

  4. Incorporate other indicators like RSI to validate signals.

  5. Add more products like futures and forex for parameter testing.

  6. Incremental parameter tuning to find optimal combinations.

  7. Apply machine learning models to find optimal parameters automatically.

Conclusion

The Multi-Bar Direction strategy identifies potential reversal signals by statistically analyzing candlestick probabilities. But the performance depends on parameter tuning based on sufficient optimizations. In addition, reversal signals have misjudgement risks and need validation. Overall, this is a simple and effective statistical strategy worthwhile for further research and optimization.

Source
Pine
/*backtest
start: 2023-10-16 00:00:00
end: 2023-10-17 00:00:00
period: 5m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// BO - Bar's direction Signal - Backtesting
//anch.v43
// © inno14
//@version=4
Strategy parameters
Strategy parameters
=== Periods Counting ===
From Day
From Month
From Year
To Day
To Month
To Year
=== Trading Time ===
Time Zone
From Hour
From Minute
To Hour
To Minute
Highlight Tradingtime
=== Date Backtesting ===
From Day
From Month
From Year
To Day
To Month
To Year
=== Setup Options ===
Reversal after 2 bars same direction
Reversal after 3 bars same direction
Reversal after 4 bars same direction
Reversal after 5 bars same direction
Reversal after 6 bars same direction
Comment
All comments (0)
No data
No data
  • 1
iPhone Download
Forums
PINE Language
© 2015 - ∞ INVENTOR PTE LTD (SG)