PROTECTED SOURCE SCRIPT
Atualizado BB_MES Playbook Levels + Auto Alerts (Start/TP1/TP2)

Indicator Name: MES Playbook Levels + Auto Alerts (Start/TP1/TP2)
1. Indicator Overview
This is a comprehensive technical analysis tool designed for day traders, specifically for Micro E-mini S&P 500 futures (MES) but applicable to other instruments. Its primary purpose is to automate the drawing of key price levels and to provide timely alerts for a specific trading strategy, often called a "playbook" setup.
The core of the strategy involves identifying a "start" level during the regular trading session. Once the price crosses this level, the indicator automatically projects two take-profit (TP1 and TP2) targets and monitors the price action in relation to these levels.
2. Key Features
Automatic Level Plotting: The indicator plots several critical price levels on the chart, saving the trader from having to draw them manually every day.
Dynamic Start Levels: It offers two methods for establishing the bullish and bearish entry or "start" levels:
Previous Day's High/Low (PDH/PDL): The default setting uses the high and low of the prior trading day as the trigger points for long and short trades.
RTH VWAP Bands: Alternatively, it can calculate the Volume-Weighted Average Price (VWAP) that resets at the start of the Regular Trading Hours (RTH) session and create a "band" around it. The edges of this band then serve as the start levels.
Automated Take-Profit Targets: Upon a cross of a "start" level, the indicator immediately plots two take-profit lines (TP1 and TP2) based on a user-defined point value.
Trade State Management: The script intelligently manages the state of a trade. It knows when a long or short trade is active and will stop looking for new signals until the current trade is concluded (either by hitting TP2 or the end of the session).
Comprehensive Alerts: A major feature is its robust alert system. Traders can set up alerts for a wide variety of events, allowing for less screen time.
Session Highlighting: It specifically monitors the Regular Trading Hours (RTH) session and can also plot the high and low of the overnight (ON) session.
3. On-Chart Visuals
When you apply this indicator to your chart, you will see the following lines and plots:
Previous Day Levels:
PDH (Previous Day High): Plotted as a green line.
PDL (Previous Day Low): Plotted as a red line.
PDC (Previous Day Close): Plotted as a gray line.
Start Levels:
StartBull: A lime green line representing the trigger for a long trade.
StartBear: A maroon line representing the trigger for a short trade.
Take-Profit Levels:
TP1 / TP2: Teal-colored lines that appear only after a StartBull or StartBear level is crossed. TP1 is a dotted line, and TP2 is solid.
Other Levels:
RTH VWAP: A blue line showing the volume-weighted average price for the main session only.
ON High / ON Low: Orange lines showing the high and low points established outside of the RTH session.
4. How It Works: The Trading Logic
Define Session: The script first identifies the Regular Trading Hours (e.g., 9:30 AM to 4:00 PM EST).
Calculate Levels: It calculates the PDH/PDL and the RTH VWAP. Based on user input, it determines the startBullLevel (either PDH or the upper VWAP band) and the startBearLevel (either PDL or the lower VWAP band).
Wait for Signal: During the RTH session, the indicator waits for the live price (close) to cross over the startBullLevel or cross under the startBearLevel.
Initiate Trade State:
If a bullish cross occurs (longStart), it logs the entryPrice, sets the trade state to longActive, and plots the TP1 and TP2 lines above the entry price.
If a bearish cross occurs (shortStart), it does the opposite, plotting TP1 and TP2 below the entry price.
Monitor Trade: While a trade is active, it checks if the price hits TP1 or TP2.
End Trade:
When the price hits the TP2 level, the trade is considered complete. The script clears the TP lines from the chart and resets itself to look for the next start signal.
At the end of the RTH session, any active trade is automatically terminated, and all TP lines are cleared to ensure a clean slate for the next day.
5. Input Settings (Customization)
The user can customize the following parameters in the indicator's settings:
RTH Session: Define the start and end times for the main trading session.
Start from RTH VWAP band: A checkbox to switch between using PDH/PDL or the VWAP band for start levels.
VWAP band offset (pts): If using the VWAP band, this sets how many points away from the VWAP the start levels are drawn.
TP1 (pts): The number of points from the entry price to set the first take-profit target.
TP2 (pts): The number of points for the second take-profit target.
Show Overnight High/Low: A toggle to show or hide the overnight session levels.
6. Configurable Alerts
You can create alerts in TradingView for any of the following conditions generated by the script:
StartBull / StartBear: Triggers when a long or short trade is initiated.
TP1 Hit / TP2 Hit: Triggers when the price reaches the take-profit levels for both long and short trades.
Level Crosses: Separate alerts can be set for when the price crosses the PDH, PDL, PDC, RTH VWAP, ON High, or ON Low. This is useful for general market awareness.
1. Indicator Overview
This is a comprehensive technical analysis tool designed for day traders, specifically for Micro E-mini S&P 500 futures (MES) but applicable to other instruments. Its primary purpose is to automate the drawing of key price levels and to provide timely alerts for a specific trading strategy, often called a "playbook" setup.
The core of the strategy involves identifying a "start" level during the regular trading session. Once the price crosses this level, the indicator automatically projects two take-profit (TP1 and TP2) targets and monitors the price action in relation to these levels.
2. Key Features
Automatic Level Plotting: The indicator plots several critical price levels on the chart, saving the trader from having to draw them manually every day.
Dynamic Start Levels: It offers two methods for establishing the bullish and bearish entry or "start" levels:
Previous Day's High/Low (PDH/PDL): The default setting uses the high and low of the prior trading day as the trigger points for long and short trades.
RTH VWAP Bands: Alternatively, it can calculate the Volume-Weighted Average Price (VWAP) that resets at the start of the Regular Trading Hours (RTH) session and create a "band" around it. The edges of this band then serve as the start levels.
Automated Take-Profit Targets: Upon a cross of a "start" level, the indicator immediately plots two take-profit lines (TP1 and TP2) based on a user-defined point value.
Trade State Management: The script intelligently manages the state of a trade. It knows when a long or short trade is active and will stop looking for new signals until the current trade is concluded (either by hitting TP2 or the end of the session).
Comprehensive Alerts: A major feature is its robust alert system. Traders can set up alerts for a wide variety of events, allowing for less screen time.
Session Highlighting: It specifically monitors the Regular Trading Hours (RTH) session and can also plot the high and low of the overnight (ON) session.
3. On-Chart Visuals
When you apply this indicator to your chart, you will see the following lines and plots:
Previous Day Levels:
PDH (Previous Day High): Plotted as a green line.
PDL (Previous Day Low): Plotted as a red line.
PDC (Previous Day Close): Plotted as a gray line.
Start Levels:
StartBull: A lime green line representing the trigger for a long trade.
StartBear: A maroon line representing the trigger for a short trade.
Take-Profit Levels:
TP1 / TP2: Teal-colored lines that appear only after a StartBull or StartBear level is crossed. TP1 is a dotted line, and TP2 is solid.
Other Levels:
RTH VWAP: A blue line showing the volume-weighted average price for the main session only.
ON High / ON Low: Orange lines showing the high and low points established outside of the RTH session.
4. How It Works: The Trading Logic
Define Session: The script first identifies the Regular Trading Hours (e.g., 9:30 AM to 4:00 PM EST).
Calculate Levels: It calculates the PDH/PDL and the RTH VWAP. Based on user input, it determines the startBullLevel (either PDH or the upper VWAP band) and the startBearLevel (either PDL or the lower VWAP band).
Wait for Signal: During the RTH session, the indicator waits for the live price (close) to cross over the startBullLevel or cross under the startBearLevel.
Initiate Trade State:
If a bullish cross occurs (longStart), it logs the entryPrice, sets the trade state to longActive, and plots the TP1 and TP2 lines above the entry price.
If a bearish cross occurs (shortStart), it does the opposite, plotting TP1 and TP2 below the entry price.
Monitor Trade: While a trade is active, it checks if the price hits TP1 or TP2.
End Trade:
When the price hits the TP2 level, the trade is considered complete. The script clears the TP lines from the chart and resets itself to look for the next start signal.
At the end of the RTH session, any active trade is automatically terminated, and all TP lines are cleared to ensure a clean slate for the next day.
5. Input Settings (Customization)
The user can customize the following parameters in the indicator's settings:
RTH Session: Define the start and end times for the main trading session.
Start from RTH VWAP band: A checkbox to switch between using PDH/PDL or the VWAP band for start levels.
VWAP band offset (pts): If using the VWAP band, this sets how many points away from the VWAP the start levels are drawn.
TP1 (pts): The number of points from the entry price to set the first take-profit target.
TP2 (pts): The number of points for the second take-profit target.
Show Overnight High/Low: A toggle to show or hide the overnight session levels.
6. Configurable Alerts
You can create alerts in TradingView for any of the following conditions generated by the script:
StartBull / StartBear: Triggers when a long or short trade is initiated.
TP1 Hit / TP2 Hit: Triggers when the price reaches the take-profit levels for both long and short trades.
Level Crosses: Separate alerts can be set for when the price crosses the PDH, PDL, PDC, RTH VWAP, ON High, or ON Low. This is useful for general market awareness.
Notas de Lançamento
sameNotas de Lançamento
.Notas de Lançamento
.Notas de Lançamento
.Notas de Lançamento
.Notas de Lançamento
.Notas de Lançamento
.Notas de Lançamento
.Notas de Lançamento
.Notas de Lançamento
.Notas de Lançamento
.Notas de Lançamento
.Notas de Lançamento
.Script protegido
Esse script é publicada como código fechado. No entanto, você pode usar ele livremente e sem nenhuma limitação – saiba mais aqui.
Aviso legal
As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.
Script protegido
Esse script é publicada como código fechado. No entanto, você pode usar ele livremente e sem nenhuma limitação – saiba mais aqui.
Aviso legal
As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.