OPEN-SOURCE SCRIPT

IU Gap Fill Strategy

219
The IU Gap Fill Strategy is designed to capitalize on price gaps that occur between trading sessions. It identifies gaps based on a user-defined percentage threshold and executes trades when the price fills the gap within a day. This strategy is ideal for traders looking to take advantage of market inefficiencies that arise due to overnight or session-based price movements. An ATR-based trailing stop-loss is incorporated to dynamically manage risk and lock in profits.

USER INPUTS
Percentage Difference for Valid Gap - Defines the minimum gap size in percentage terms for a valid trade setup. ( Default is 0.2 )
ATR Length - Sets the lookback period for the Average True Range (ATR) calculation. (default is 14 )
ATR Factor - Determines the multiplier for the trailing stop-loss, helping in risk management. ( Default is 2.00 )
snapshot


LONG CONDITION
  1. A gap-up occurs, meaning the current session opens above the previous session’s close.
  2. The price initially dips below the previous session's close but then recovers and closes above it.
  3. The gap meets the valid percentage threshold set by the user.
  4. The bar is not the first or last bar of the session to avoid false signals.

snapshot

SHORT CONDITION
  1. A gap-down occurs, meaning the current session opens below the previous session’s close.
  2. The price initially moves above the previous session’s close but then closes below it.
  3. The gap meets the valid percentage threshold set by the user.
  4. The bar is not the first or last bar of the session to avoid false signals.

snapshot


LONG EXIT
An ATR-based trailing stop-loss is set below the entry price and dynamically adjusts upwards as the price moves in favor of the trade.
The position is closed when the trailing stop-loss is hit.
snapshot


SHORT EXIT
An ATR-based trailing stop-loss is set above the entry price and dynamically adjusts downwards as the price moves in favor of the trade.
The position is closed when the trailing stop-loss is hit.
snapshot


WHY IT IS UNIQUE
  • Precision in Identifying Gaps - The strategy focuses on real price gaps rather than minor fluctuations.
  • Dynamic Risk Management - Uses ATR-based trailing stop-loss to secure profits while allowing the trade to run.
  • Versatility - Works on stocks, indices, forex, and any market that experiences session-based gaps.
  • Optimized Entry Conditions - Ensures entries are taken only when the price attempts to fill the gap, reducing false signals.


HOW USERS CAN BENEFIT FROM IT
  • Enhance Trade Timing - Captures high-probability trade setups based on market inefficiencies caused by gaps.
  • Minimize Risk - The ATR trailing stop-loss helps protect gains and limit losses.
  • Works in Different Market Conditions - Whether markets are trending or consolidating, the strategy adapts to potential gap fill opportunities.
  • Fully Customizable - Users can fine-tune gap percentage, ATR settings, and stop-loss parameters to match their trading style.


Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.