PROTECTED SOURCE SCRIPT
Updated

IC Swing - V1

44
The core goal of the script is to capture trades that align with a strong trend confirmed by the Ichimoku Cloud and ADX/DMI, with entries based on a Kijun-Tenkan cross and exits managed by dynamic swing pivot-based trailing stops.

Position Management & Exit Logic
The strategy uses a robust, two-part system to manage risk and lock in profits:

Initial Stop Loss (SL): An immediate, hard stop-loss is placed when a trade opens, calculated as the ATR Multiplier (default 2.0) away from the entry bar's low (for long) or high (for short). This provides instant protection.

Trailing Stop: After a configurable delay (minBarsBeforeExit, default 2 bars), the initial stop-loss is overwritten by a dynamic trailing stop. This stop is based on the last confirmed swing pivot (low for long, high for short), buffered by a small ATR amount (0.5). The stop only trails in the direction of the trade (e.g., moves up for a long trade) and never moves against it.

Hard Exit (Swing Break): The position is closed if the price breaks the last confirmed swing pivot against the trade direction, acting as a second, swing-based exit mechanism.

Latching Exits: The exitLatchLong/exitLatchShort variables are used to prevent the strategy from immediately reversing or re-entering on the same bar after a position has been closed due to a stop hit or a hard exit.
Release Notes
Bot alerts - fixed
Release Notes
Alerts - fixed
Release Notes
Alert fixed
Release Notes
Alert
Release Notes
alert

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.