I want to know how many times a stock has had a high that was 2% or more greater then the open. Here's my code:
def condition = if ((high - open)/open)*100 >= 2 then 1 else 0;
def counter = if condition == 1 then counter[1] + 1 else counter[1];
When I run this script on ANF, for example, I get a count of 163. But my chart is on a Monthly timeframe, the range is 8 years, so there's only 96 bars on the chart. Not understanding this counter result.
def condition = if ((high - open)/open)*100 >= 2 then 1 else 0;
def counter = if condition == 1 then counter[1] + 1 else counter[1];
When I run this script on ANF, for example, I get a count of 163. But my chart is on a Monthly timeframe, the range is 8 years, so there's only 96 bars on the chart. Not understanding this counter result.