OPEN-SOURCE SCRIPT
Aktualisiert Sentry Mode: Dynamic Trend & Exit System

Sentry Mode is designed for traders who prioritize risk management and structural trend alignment. It eliminates the guesswork of "How much should I buy?" by calculating your exact share count based on a live-tracking stop loss.
Core Features
1. The Sentry Position Manager (Quantitative Table)
The centerpiece of this script is a real-time data table that calculates:
Target vs. Actual Risk: Sees the gap between your desired equity risk and the actual dollar amount at stake after share rounding.
Dynamic Stop (Ribbon Top): The stop loss isn't a fixed percentage; it tracks the Low of the leading Moving Average in the ribbon, providing a "trailing floor."
Position Sizing: Automatically calculates shares based on your Account Size and Max Position % cap.
Invalid Price Filter: The Sentry will reject trade calculations (showing "PRICE BELOW STOP") if the asset is currently trading below the structural floor.
2. Structural Trend Ribbon
5-MA Cluster: Uses up to five user-selectable Moving Averages (SMA, EMA, WMA, etc.) to visualize trend strength.
Ribbon Top Analysis: Automatically identifies the "Fastest" MA to set the current trend boundary.
3rd MA Floor: Identifies the "meat" of the trend, serving as a secondary structural exit for trailing stops.
3. Multi-Timeframe Pivot Analysis
The script identifies and draws institutional-grade levels:
52-Week Highs: Tracks and extends 52-week highs with automated "Broken Line" logic when price clears the level.
Multi-Day Pivots: Visualizes 5-day, 9-day, 19-day, and 90-day pivot highs to identify supply zones and breakout entries.
Downtrend Resistance: Automatically plots 19-bar downward trendlines to identify "Cheat" entries and downtrend breaks.
4. SPY Market Context Filter
Broad Market Alignment: Includes a background color filter based on SPY (S&P 500) trend health.
ATR Volatility Scaling: The background changes intensity (L1, L2, L3) based on SPY’s ATR, warning you when the broad market is undergoing a "normal pullback" versus a "high-volatility breakdown."
4. How to Use
Define your Bankroll: In the settings, input your total Account Size and the percentage of equity you are willing to risk per trade (e.g., 0.25%).
Confirm the Trend: Look for price to be above the Ribbon Top. Ensure the SPY Context background is green.
Execute via Sentry Table: Read the "Shares" and "Pos Size" directly from the on-screen table.
Manage the Exit: The red dashed Sentry Line shows your floor. If price closes below this line (or the 3rd MA), the trend structure is broken.
5. Technical Details (For the Sidebar)
Signal Type: Trend-Following / Momentum.
Core Features
1. The Sentry Position Manager (Quantitative Table)
The centerpiece of this script is a real-time data table that calculates:
Target vs. Actual Risk: Sees the gap between your desired equity risk and the actual dollar amount at stake after share rounding.
Dynamic Stop (Ribbon Top): The stop loss isn't a fixed percentage; it tracks the Low of the leading Moving Average in the ribbon, providing a "trailing floor."
Position Sizing: Automatically calculates shares based on your Account Size and Max Position % cap.
Invalid Price Filter: The Sentry will reject trade calculations (showing "PRICE BELOW STOP") if the asset is currently trading below the structural floor.
2. Structural Trend Ribbon
5-MA Cluster: Uses up to five user-selectable Moving Averages (SMA, EMA, WMA, etc.) to visualize trend strength.
Ribbon Top Analysis: Automatically identifies the "Fastest" MA to set the current trend boundary.
3rd MA Floor: Identifies the "meat" of the trend, serving as a secondary structural exit for trailing stops.
3. Multi-Timeframe Pivot Analysis
The script identifies and draws institutional-grade levels:
52-Week Highs: Tracks and extends 52-week highs with automated "Broken Line" logic when price clears the level.
Multi-Day Pivots: Visualizes 5-day, 9-day, 19-day, and 90-day pivot highs to identify supply zones and breakout entries.
Downtrend Resistance: Automatically plots 19-bar downward trendlines to identify "Cheat" entries and downtrend breaks.
4. SPY Market Context Filter
Broad Market Alignment: Includes a background color filter based on SPY (S&P 500) trend health.
ATR Volatility Scaling: The background changes intensity (L1, L2, L3) based on SPY’s ATR, warning you when the broad market is undergoing a "normal pullback" versus a "high-volatility breakdown."
4. How to Use
Define your Bankroll: In the settings, input your total Account Size and the percentage of equity you are willing to risk per trade (e.g., 0.25%).
Confirm the Trend: Look for price to be above the Ribbon Top. Ensure the SPY Context background is green.
Execute via Sentry Table: Read the "Shares" and "Pos Size" directly from the on-screen table.
Manage the Exit: The red dashed Sentry Line shows your floor. If price closes below this line (or the 3rd MA), the trend structure is broken.
5. Technical Details (For the Sidebar)
Signal Type: Trend-Following / Momentum.
Versionshinweise
Added Alerts for different conditionsAdded Reference stop and target levels with price and % for better visuals of risk reward from Buy alert
It will work on Pine screener
Versionshinweise
Updated to remove extra plots, improvements to use pine screener export for portfolio approach. like, if you use sma50 for stop loss, then screen your portfolio watchlist and export the results for position size dollar risk and other parameters to excel and check how much are you invested if you are using this risk management approach and open portfolio heat.Versionshinweise
Added Two AlertsIf used on pine screener you stocks which are strong in strong market and strong in week market.
Sentry: Trend Strong With Market
Sentry: Trend Strong Against Market
Versionshinweise
Priming Bars Breaking up and Breaking Down label added. Versionshinweise
Position Management table updated to reflect stat of current barVersionshinweise
Few updates for better codeVersionshinweise
Updated few thingsVersionshinweise
Mini Coil updateVersionshinweise
Coil logic updateVersionshinweise
Addition of 19 Day Low Pivot LineVersionshinweise
Fixed typo 19 , earlier it was 9 for 19 day pivot low.Versionshinweise
Added Base PivotsOpen-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.