This ProBuilder code snippet is designed to count how many times the closing price of a stock exceeds the highest closing price of the previous 10 periods within the same candle. This can be useful for traders who are looking to identify increased momentum or strength in price movement during a trading session.
HH = Highest[10](Close)
if barindex>10 then
once $last[0]=hh
once $barindex[0]=barindex
if barindex>$barindex[0] then //new bar
$barindex[0]=barindex
$last[0]=hh
$count[barindex]=0
endif
if close>$last[0] then
$last[0]=hh
$count[barindex]=$count[barindex]+1
endif
endif
return $count[barindex] style(histogram) as "count"//,$last[0]
Explanation of the Code:
This code is particularly useful for analyzing price action and can help in making decisions based on intra-candle price movements.
Check out this related content for more information:
https://www.prorealcode.com/topic/nombre-de-fois-que-close-crosses-over-une-variable/#post-207330
Visit Link