OPEN-SOURCE SCRIPT
Peter Brandt's 3-Day Trailing Stop

Peter Brandt's 3-day trailing stop rule is a trend-following exit strategy where a sell signal is triggered after a stock has reached a new high, followed by a close below the low of that high day, and then a break below the low of the next day, which is called the "setup day". The rule can be reversed to exit a short position. For long positions, Day 1 is the "high day" with a new price high, Day 2 is the "setup day" where the price closes below the low of Day 1, and Day 3 is the "trigger day" where a sell is executed if the price falls below the low of the setup day.
Long exit signal
Day 1: High Day: — The stock makes a new high.
Day 2: Setup Day: — The stock closes below the low of Day 1. At this point, the exit signal is now active.
Day 3: Trigger Day: — A sell to close is triggered when the price breaks below the low of the "setup day" (Day 2).
Short exit signal
Day 1: Low Day: — The stock makes a new low.
Day 2: Setup Day: — The stock closes above the high of Day 1.
Day 3: Trigger Day: — A buy to close is triggered when the price breaks above the high of the "setup day" (Day 2).
Long exit signal
Day 1: High Day: — The stock makes a new high.
Day 2: Setup Day: — The stock closes below the low of Day 1. At this point, the exit signal is now active.
Day 3: Trigger Day: — A sell to close is triggered when the price breaks below the low of the "setup day" (Day 2).
Short exit signal
Day 1: Low Day: — The stock makes a new low.
Day 2: Setup Day: — The stock closes above the high of Day 1.
Day 3: Trigger Day: — A buy to close is triggered when the price breaks above the high of the "setup day" (Day 2).
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
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.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
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.