Type/to search

Architecture Breakthrough Backtesting Strategy

Cryptocurrency
Created: 2023-10-17 17:26:03
Last modified: 3 years ago
1
Follow
1781
Followers

img

Overview

This strategy adopts a level breakthrough approach to go long or short under certain breakthrough conditions, and has auto-backtesting capabilities to find the optimal parameter combination.

Principle

  1. Input parameters include lookback days, take profit percentage, stop loss percentage, and auto-backtesting parameters like lookback range, take profit/stop loss range etc.

  2. During backtesting, traverse various combinations of lookback, take profit and stop loss, and record PnL for each combination.

  3. Breakthrough signal logic: long when close breaks above upper band and not the entry bar, short when close breaks below lower band and not the entry bar.

  4. Stop loss condition: if not take profited and stop loss is triggered, exit the trade.

  5. Take profit condition: if not stopped out and take profit is triggered, exit the trade.

  6. Display detailed backtest results table, sortable by win rate, net profit or number of trades based on user settings.

Advantages

  1. Auto backtest can quickly find optimal parameter sets without manual testing.

  2. Sort backtest results flexibly by win rate, net profit, number of trades etc according to needs.

  3. Visualize PnL for each trade.

  4. Customizable backtest parameters for testing wider parameter space to find global optimum.

  5. Simple and clear trading rules easy to understand and implement.

Risks and Solutions

  1. Short backtest period may lead to unstable results. Solution: use longer backtest period.

  2. Frequent trading prone to slippage affecting profitability. Solution: relax take profit/stop loss levels appropriately.

  3. Single instrument backtest may not be representative. Solution: test on different products to find robust parameter sets.

  4. Over-optimized parameters cause overfitting. Solution: test stability of parameters across products and timeframes.

  5. Ignoring transaction costs lead to bias in results. Solution: use reasonable commission settings.

Enhancement Directions

  1. Increase optimization dimensions like adding trailing stop or trade limits.

  2. Optimize entry conditions with trend filters.

  3. Enhance take profit/stop loss like dynamic take profit or trailing stop loss.

  4. Introduce machine learning for parameter optimization.

  5. Optimize code structure for faster backtesting.

  6. Test parameter robustness across products and timeframes.

  7. Consider integrating auto trading capabilities.

Conclusion

The strategy has clear and simple logic, auto backtesting enables quick parameter tuning, PnL display facilitates further improvements. Risks exist but can be reduced through multi-dimensional optimizations, with strong practical value. In summary, this strategy equipped with auto backtesting tools can help traders quickly develop stable trading systems based on simple breakout concepts.

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

// © -_-
//@version=5
// strategy("[-_-] LBAB", process_orders_on_close=true, overlay=true, max_labels_count=500, max_lines_count=500, max_boxes_count=500, default_qty_type=strategy.cash, default_qty_value=100, initial_capital=10000, commission_type=strategy.commission.percent, commission_value=0.075)
Strategy parameters
Strategy parameters
Lookback
TP (%)
SL (% from Low)
Commission (%)
Optimisation
Min Lookback
Max Lookback
Min TP (%)
Max TP (%)
Min SL (%)
Max SL (%)
Percentage profitable
Net profit
Number of trades
Table
Position
Font size
Comment
All comments (0)
No data
No data
  • 1
iPhone Download
Forums
PINE Language
© 2015 - ∞ INVENTOR PTE LTD (SG)