Type/to search

Trailing Stop Loss Strategy Based on Price Gaps

Cryptocurrency
Created: 2023-11-28 13:53:16
Last modified: 3 years ago
1
Follow
1779
Followers

img

Overview

This strategy adopts the price gap principle to go long when price breaks recent lows, with stop loss and take profit orders to trail the lowest price for profit taking.

Strategy Logic

It identifies gaps when price breaks below the lowest price in recent N hours, goes long based on configured percentage, with stop loss and take profit orders. Stop loss line and take profit line move according to price action. The logic is:

  1. Calculate lowest price in recent N hours as binding price
  2. Go long when realtime price is below binding price * buy percent
  3. Set take profit based on entry price * sell percent
  4. Set stop loss based on entry price - entry price * stop loss percent
  5. Position size is percent of strategy equity
  6. Trail stop loss line with lowest price
  7. Close position when take profit or stop loss is triggered

Advantage Analysis

The advantages of this strategy:

  1. Utilize price gap concept, improve winning rate
  2. Automatic trailing stop loss to lock in most profits
  3. Customizable stop loss and take profit percentage for different markets
  4. Works well for instruments with obvious rebounds
  5. Simple logic and easy to implement

Risk Analysis

There are also some risks:

  1. Breakout of gaps may fail with lower lows
  2. Improper stop loss or take profit settings may cause premature exit
  3. Require periodic parameter tuning for market changes
  4. Limited applicable instruments, may not work for some
  5. Manual intervention needed from time to time

Optimization Directions

The strategy can be improved in the following aspects:

  1. Add machine learning models for automatic parameter tuning
  2. Add more types of stop loss/take profit, e.g. trailing stop loss, bracket orders
  3. Optimize stop loss/take profit logic for smarter exits
  4. Incorporate more indicators to filter out false signals
  5. Expand to more instruments to improve universality

Conclusion

In conclusion, this is a simple and effective trailing stop loss strategy based on price gaps. It reduces false entries and locks in profits effectively. There is still much room for improvements in parameters tuning and signal filtering. It is worth further research and refinement.

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

//@version=4

strategy(title="Squeeze Backtest by Shaqi v1.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)
strategy.risk.allow_entry_in(strategy.direction.long)
Strategy parameters
Strategy parameters
Squeeze Settings
Buy, %
Sell, %
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)