Hello,
I am on an hourly chart. I would like to gather the statistics of specific conditions at specific times throughout the day. Currently I have a script to capture the condition once at market open at 9:30am, then use AddLabel to display the stats. I would like to have the stats displayed on every hour, above the bar, perhaps using AddChartBubble.
The current code I have is below:
Is there an efficient way to do this or creating a separate condition variable for each hour is the only way to go? Also what if I need to flip to another time frame, like 30 min? I think I don't want to remove the 'SecondsFromTime(0930) == 0', because it will not capture the count correctly.
Appreciate any help in advance.
I am on an hourly chart. I would like to gather the statistics of specific conditions at specific times throughout the day. Currently I have a script to capture the condition once at market open at 9:30am, then use AddLabel to display the stats. I would like to have the stats displayed on every hour, above the bar, perhaps using AddChartBubble.
The current code I have is below:
Code:
condition = if SecondsFromTime(0930) == 0 and [some condition criteria] then 1 else 0;
conditioncnt = if condition then conditioncnt[1] + 1 else conditionct[1];
AddLabel(1, condition + "-" + conditioncnt, Color.white);
Is there an efficient way to do this or creating a separate condition variable for each hour is the only way to go? Also what if I need to flip to another time frame, like 30 min? I think I don't want to remove the 'SecondsFromTime(0930) == 0', because it will not capture the count correctly.
Appreciate any help in advance.