Opening Price Deviations with Alerts

The Timeframe Opening Price Deviations indicator helps traders visualize how price deviates from a key reference point—the opening price of a selected timeframe (Daily, Weekly, or Monthly). It calculates upper and lower deviation levels based on a percentage step and plots these levels on the chart. This can help traders identify potential areas of support and resistance.
----------------------------------------------------------------------------------------------------------------------
How It Works
Opening Price Reference:
- The script retrieves the opening price of the selected timeframe (Daily, Weekly, or Monthly).
Deviation Levels Calculation:
- Five upper and lower deviation levels are calculated based on a percentage step input by the user.
- Each level is determined by multiplying the opening price by (1 ± step size).
Visualization
- The indicator plots the calculated levels as horizontal lines above and below the opening price.
- Labels appear only on the latest bar, displaying the exact price level along with its percentage deviation from the opening price.
- User has the option to turn on/off or change the bar colours. If price is within the 1st deviation lines that's considered neutral coloured orange as default. If price is above/below the first deviation levels the bar colours will be green or red.
---------------------------------------------------------------------------------------------------------------------
Potential Use Cases
Support & Resistance Zones 🟢🔴
- The deviation levels can act as potential areas where price may reverse or consolidate based on historical price behaviour.
Breakout & Reversion Strategies 📈📉
- If price breaks above an upper deviation level, it could indicate momentum continuation.
- If price rejects from a level, it might suggest a mean reversion opportunity.
Trend Strength Analysis 🔍
- The distance between the price and deviation levels can help traders assess whether a trend is strong (moving away from the opening price) or weak (hovering near the opening price).
Intraday vs. Multi-Timeframe Perspective 🕒
- By selecting different timeframes (Daily, Weekly, Monthly), traders can align intraday price movements with higher timeframe reference points for added confluence.
---------------------------------------------------------------------------------------------------------------------
Customization Options
- Timeframe Selection: Choose between Daily, Weekly, or Monthly opening prices.
- Deviation Step (%): Adjust the step size to control the spacing between deviation levels.
- Colour Bars: User Is able to change the colour of the bars.
---------------------------------------------------------------------------------------------------------------------
Alerts
This Indicator also has alerts for when price crosses above/below a deviation line. It will tell you the ticker, price and time
---------------------------------------------------------------------------------------------------------------------
Final Notes
This indicator is purely for technical analysis and should not be used as a standalone trading system. It works best when combined with price action, volume analysis, or other indicators of you're choosing to refine trade decisions.
Happy Trading! 🚀📊
---------------------------------------------------------------------------------------------------------------------
This explanation is clear, informative, and compliant with TradingView’s House Rules.
Added alert for Opening Price:
Only becomes active once price has crossed the first upper/lower deviation levels. // Will only be reset if price crosses the first upper/lower deviation levels.
1️⃣ Calculate Price Changes:
It calculates the percentage change from the opening price (higherOpen).
This tells you how much the price has moved (up or down) relative to the opening price.
2️⃣ Find the Highest High & Lowest Low in the Selected Timeframe:
It retrieves the highest high and lowest low for the selected timeframe using:
- highestHigh = request.security(syminfo.tickerid, timeframe, ta.highest(high, 1))
- lowestLow = request.security(syminfo.tickerid, timeframe, ta.lowest(low, 1))
Then, it calculates how far the current closing price is from these extremes:
- percentFromHighestHigh = (close - highestHigh) / highestHigh * 100
- percentFromLowestLow = (close - lowestLow) / lowestLow * 100
These percentages indicate how much price has fallen from the highest point and risen from the lowest point within the selected timeframe.
3️⃣ Display a Table in the Chart:
A table with 4 rows and 2 columns is created in the top-right of the chart.
- Opening Price (Displays higherOpen)
- Price Change (Displays priceChangePercent and colors it green if positive, red if negative)
- From Highest High (Shows distance from the highest price)
- From Lowest Low (Shows distance from the lowest price)
4️⃣ Conditional Formatting for Better Visualization:
Price Change (%):
- Green if price increased.
- Red if price decreased.
Highest High vs. Lowest Low Comparison:
- If price is closer to the highest high, the "From Highest High" value is red (suggesting weakness).
- If price is closer to the lowest low, the "From Lowest Low" value is green (suggesting recovery).
- The weaker level is colored Black for a neutral effect.
---------------------------------------------------------------------------------------------------------------------
🟢 Key Objectives Achieved
✅ Real-time price tracking: Shows % changes dynamically.
✅ Identifies trend strength: Helps see whether price is near highs or lows.
✅ Easy-to-read visualization: Uses color coding for quick analysis.
✅ Works on any timeframe: Uses request.security to fetch data for different timeframes.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Per un accesso rapido a un grafico, aggiungi questo script ai tuoi preferiti: per saperne di più clicca qui.
Declinazione di responsabilità
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Per un accesso rapido a un grafico, aggiungi questo script ai tuoi preferiti: per saperne di più clicca qui.