Cumulative Total Count of Tick Movements in a Bar?
Posted: Tue Apr 27, 2021 1:27 am
Hi everyone, I'm a bit stuck and looking for some help. I'm working on a script where I'm trying to count every tick movement, whether up or down, and show the cumulative total movement in a bar as a count. I'm stuck because so far all I can figure out how to do is calculate the range, but I want to count each individual up tick/down tick rather the the range within a candle. So everytime the price changes (no matter the direction) I want to add 1 to a count. I'm using this for ES with a minimum tick value of 0.25
The following code calculates the range just fine, but how would I modify it to count each up tick/down tick individually for a cumulative total within the candle? :
Any help is much appreciated, I've been stuck on this for a while and it's probably something really silly I'm not thinking of.
The following code calculates the range just fine, but how would I modify it to count each up tick/down tick individually for a cumulative total within the candle? :
Code: Select all
//@version=4
study(title="Tick Travel", shorttitle="Tick Travel")
open_pos = open*1
high_pos = high*1
low_pos = low*1
highdiff = abs(high_pos-open_pos)
lowdiff = abs(low_pos-open_pos)
selected = max(highdiff, lowdiff)
pricelevel = input(title="Tick Highlighter >=", type=float, defval=0.25)
plot(selected, style=columns, color=selected >= pricelevel ? white : silver)
Any help is much appreciated, I've been stuck on this for a while and it's probably something really silly I'm not thinking of.