OPEN-SOURCE SCRIPT

9:30 AM Open Percentage Lines

25
//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)

免責事項

これらの情報および投稿は、TradingViewが提供または保証する金融、投資、取引、またはその他の種類のアドバイスや推奨を意図したものではなく、またそのようなものでもありません。詳しくは利用規約をご覧ください。