This ProBuilder script is designed to capture and display the price and bar index of a financial instrument at exactly 11:00 AM. It is useful for traders who need to analyze price action at specific times of the day.
DEFPARAM DrawOnLastBarOnly = true
IF (Time = 110000) OR (Time > 110000 AND Time[1] < 110000) THEN
PriceAT11 = close[1]
BarAT11 = barindex
ENDIF
IF PriceAT11 > 0 THEN
DRAWTEXT("Price at 11:00:00 #PriceAT11#", BarAT11, PriceAT11)
ENDIF
RETURN
This script performs the following steps:
DEFPARAM DrawOnLastBarOnly = true ensures that drawing commands (like DRAWTEXT) only execute on the last available bar to avoid cluttering the chart.IF statement checks if the current time is exactly 11:00 AM or if it has just passed 11:00 AM since the last checked bar. This is done using the Time and Time[1] variables, where Time[1] represents the time of the previous bar.close[1]) is stored in PriceAT11, and the current bar index (barindex) is stored in BarAT11. These variables capture the price and the position of the bar at 11:00 AM.IF statement checks if PriceAT11 has been set (i.e., is greater than 0). If true, it uses DRAWTEXT to display the price at 11:00 AM on the chart at the corresponding bar index.This script is particularly useful for back-testing strategies that require analysis of price action at specific times or for visually marking important times on trading charts.
Check out this related content for more information:
https://www.prorealcode.com/topic/multiple-timeframes-2/page/2/#post-109913
Visit Link