Type/to search

Squeeze Backtest Transformer v2.0

Cryptocurrency
Created: 2024-04-28 14:09:26
Last modified: 2 years ago
1
Follow
1781
Followers

img

Overview

Squeeze Backtest Transformer v2.0 is a quantitative trading system based on a squeeze strategy. By setting parameters such as entry, stop loss, take profit percentages, and maximum holding time, it backtests the strategy within a specific time range. The strategy supports multi-directional trading and can flexibly set the trading direction to long or short. At the same time, the strategy also provides rich options for setting the backtest period, which can easily select a fixed time range or the maximum backtest time.

Strategy Principle

  1. First, determine the start and end time of the backtest based on the backtest period parameters set by the user.
  2. During the backtest period, if there is no current position and the price reaches the entry price (calculated based on the opening percentage), open a position and set the stop loss and take profit prices (calculated based on the stop loss and take profit percentages) at the same time.
  3. If a position is already held, cancel the previous take profit and stop loss orders and reset new take profit and stop loss prices (calculated based on the current position average price).
  4. If the maximum holding time is set, when the holding time reaches the maximum value, force the position to close.
  5. The strategy supports trading in both long and short directions.

Strategy Advantages

  1. Flexible parameter settings can be adjusted according to different market conditions and trading needs.
  2. Support multi-directional trading to obtain profits in different market conditions.
  3. Provide rich options for setting the backtest period, which can easily conduct historical data backtesting and analysis.
  4. Stop loss and take profit settings can effectively control risks and improve capital utilization efficiency.
  5. The maximum holding time setting can avoid holding positions for too long and facing market risks.

Strategy Risks

  1. The setting of the entry price, stop loss price and take profit price has a great impact on the strategy's return. Improper parameter settings may lead to losses.
  2. When the market fluctuates violently, a stop loss may be triggered immediately after opening a position, resulting in losses.
  3. If the maximum holding time triggers the closing of a position, it may miss the opportunity for subsequent profits.
  4. The strategy may not perform well in some special market conditions (such as a sideways market).

Strategy Optimization Direction

  1. Consider introducing more technical indicators or market sentiment indicators to optimize the conditions for entry, stop loss and take profit to improve the stability and profitability of the strategy.
  2. For the setting of the maximum holding time, it can be dynamically adjusted according to market volatility and position profit and loss to avoid the opportunity cost that a fixed time closing may bring.
  3. For the characteristics of the sideways market, logic such as sideways range breakthrough or trend reversal confirmation can be added to reduce the cost of frequent trading.
  4. Consider adding position management and capital management strategies to control the risk exposure of a single transaction and improve the efficiency and stability of capital utilization.

Summary

Squeeze Backtest Transformer v2.0 is a quantitative trading system based on a squeeze strategy that can trade in different market environments through flexible parameter settings and multi-directional trading support. At the same time, rich backtest period setting options and take profit and stop loss settings can help users conduct historical data analysis and risk control. However, the performance of the strategy is greatly affected by parameter settings and needs to be optimized and improved based on market characteristics and trading needs to improve the stability and profitability of the strategy. In the future, we can consider introducing more technical indicators, dynamically adjusting the maximum holding time, optimizing sideways market strategies, and strengthening position and capital management to optimize.

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

//@version=5

strategy(title="Squeeze Backtest by Shaqi v2.0", overlay=true, pyramiding=0, currency="USD", process_orders_on_close=true, commission_type=strategy.commission.percent, commission_value=0.075, default_qty_type=strategy.percent_of_equity, default_qty_value=100, initial_capital=100, backtest_fill_limits_assumption=0)
R0 = "6 Hours"
Strategy parameters
Strategy parameters
Squeeze Settings
Direction
Open, %
Close, %
Stop Loss, %
Max Bars To Sell
maxBars
Bind
Backtesting Period
Fixed Range
rangeStart
Backtesting Start
Backtesting End
Comment
All comments (0)
No data
No data
  • 1
iPhone Download
Forums
PINE Language
© 2015 - ∞ INVENTOR PTE LTD (SG)