OPEN-SOURCE SCRIPT
9:30 AM Open Percentage Lines

//version=5
indicator("9:30 AM Open Percentage Lines", overlay=true)
// Define the market open time in New York (or your local time zone if different)
// This is for 9:30 AM
var float opening_price = na
// Check if the current bar is the first one of the day at 9:30 AM
is_930_bar = (dayofweek == dayofweek.monday or dayofweek == dayofweek.tuesday or dayofweek == dayofweek.wednesday or dayofweek == dayofweek.thursday or dayofweek == dayofweek.friday) and hour(time("America/New_York")) == 9 and minute(time("America/New_York")) == 30
// On the first bar that meets the criteria, capture the opening price
if is_930_bar
opening_price := open
// Calculate the percentage levels based on the captured opening price
fivePercentAbove = opening_price * 1.05
sevenPercentAbove = opening_price * 1.07
twentySevenPercentAbove = opening_price * 1.27
// Plot the lines on the chart
// The `na` condition ensures the line is only plotted after the 9:30 AM bar has passed
plot(not na(opening_price) ? fivePercentAbove : na, title="5% Above 9:30 AM Open", color=color.new(color.rgb(255, 12, 12), 0), linewidth=2, trackprice=false)
plot(not na(opening_price) ? sevenPercentAbove : na, title="7% Above 9:30 AM Open", color=color.new(color.rgb(0, 150, 255), 0), linewidth=2, trackprice=false)
plot(not na(opening_price) ? twentySevenPercentAbove : na, title="27% Above 9:30 AM Open", color=color.new(color.rgb(255, 0, 0), 0), linewidth=2, trackprice=false)
indicator("9:30 AM Open Percentage Lines", overlay=true)
// Define the market open time in New York (or your local time zone if different)
// This is for 9:30 AM
var float opening_price = na
// Check if the current bar is the first one of the day at 9:30 AM
is_930_bar = (dayofweek == dayofweek.monday or dayofweek == dayofweek.tuesday or dayofweek == dayofweek.wednesday or dayofweek == dayofweek.thursday or dayofweek == dayofweek.friday) and hour(time("America/New_York")) == 9 and minute(time("America/New_York")) == 30
// On the first bar that meets the criteria, capture the opening price
if is_930_bar
opening_price := open
// Calculate the percentage levels based on the captured opening price
fivePercentAbove = opening_price * 1.05
sevenPercentAbove = opening_price * 1.07
twentySevenPercentAbove = opening_price * 1.27
// Plot the lines on the chart
// The `na` condition ensures the line is only plotted after the 9:30 AM bar has passed
plot(not na(opening_price) ? fivePercentAbove : na, title="5% Above 9:30 AM Open", color=color.new(color.rgb(255, 12, 12), 0), linewidth=2, trackprice=false)
plot(not na(opening_price) ? sevenPercentAbove : na, title="7% Above 9:30 AM Open", color=color.new(color.rgb(0, 150, 255), 0), linewidth=2, trackprice=false)
plot(not na(opening_price) ? twentySevenPercentAbove : na, title="27% Above 9:30 AM Open", color=color.new(color.rgb(255, 0, 0), 0), linewidth=2, trackprice=false)
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.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
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.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.