OPEN-SOURCE SCRIPT

Mancini Levels (with alerts, majors only option)

48
This indicator displays Support and Resistance levels on ES or MES (E-mini and Micro E-mini S&P 500 Index Futures) charts by parsing text copied and pasted by the user.

(The levels displayed on the chart above are not valid, they are for illustration only)

Features
  1. Option to display only the major levels
    The chart on the left displays both major and minor levels, distinguished by color and line style. The chart on the right shows only the major levels; minor levels are disabled:
    لقطة
  2. Alert function for when the price approaches a major level or zone (within a customizable distance).
    The script provides a trigger for alerts. When creating an alert, you can then choose your desired frequency (Only once/Once per bar/Once per bar close/Once per minute) from the TradingView alert pop-up.
    The alert message contains the current price and the approached major level price.
  3. Customizable Lookback Period
    Set how many days into the past the lines should appear (Subject to a maximum of 5000 bars).
    To display lines for the current day only, set this value to 1.
  4. Functions only on ES or MES (E-mini and Micro E-mini S&P 500 Index Futures) charts, as the text format is intended for these instruments.

How to Use

Copy and paste the support and resistance levels into the indicator's "Supports" and "Resistances" input fields.
Format Example:
For the "Supports" input: 6772-6770 (major), 6764 (major), 6757, 6751-54
For the "Resistances" input: 6799 (major), 6814, 6828-30, 6839-40 (major)
The indicator supports the display of zone levels in multiple formats
(e.g., 6235-45 and 6235-6245 and 6245-6235 are all valid).
For hundred- or thousand-point rollovers, please use only the full number format: 5995-6005.

The indicator includes an error-checking system to help you troubleshoot common setup issues.

An on-chart error label will be displayed on the chart if:
  • The chart instrument is not ES or MES.
  • The "Supports" and "Resistances" fields are both empty.
  • A data formatting error is detected (e.g., non-numeric characters, incomplete zones, etc.).

How It Works

For optimal resource efficiency and performance, the script executes all computationally intensive tasks only once, on the very first bar when the chart loads (if barstate.isfirst).
  • One-time Parsing: The parsing, splitting, and conversion of the text (string) formatted levels, which are provided in the settings, occurs only once.
  • Persistent Objects: The lines (line.new), fills (linefill.new), and price labels (label.new) that mark the levels are all persistent graphical objects. The script creates these on the first bar and stores their references in arrays declared with the var keyword.
  • No Redrawing: On subsequent bars, the indicator does not delete and redraw these objects. It merely updates the x-axis position of the existing lines and labels (line.set_x1, line.set_x2, label.set_x) on the last bar (if barstate.islast), ensuring they always remain on the right edge of the chart, following the formation of new bars.

By default, TradingView charts have a limit of 50 lines and 50 labels. Given that the number of levels often exceeds this, the script's drawing logic is as follows:
  • The number of displayable lines and labels has been increased (to 500) in the indicator's declaration line.
  • The script applies a prioritized order when drawing levels and labels. Major levels have priority over minor levels during drawing.

Disclaimer

This indicator is provided for educational and informational purposes only. It is not financial advice.

Trading involves substantial risk of loss and is not suitable for every investor. Past performance shown in examples is not indicative of future results.

The indicator provides signals and calculations, but trading decisions are solely your responsibility. Always:
Test strategies on paper before using real money
Never risk more than you can afford to lose
Understand that all trading involves risk
Consider seeking advice from a licensed financial advisor

The publisher makes no guarantees regarding accuracy, profitability, or performance. Use at your own risk.


إخلاء المسؤولية

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.