How to identify if current bar is above or below a certain percentage


Category:
0
0

How to write this as an expression;    Current bar is X% greater or lesser than previous bar.

With x being an adjustable input

Marked as spam
Posted by (Questions: 3, Answers: 2)
Asked on December 5, 2017 8:36 am
63 views
0
Private answer

Well the math formula looks like this:

100 x (current close / previous close - 1)

The code to perform that math calculation looks like this:

100 * (close / close[1] - 1)

You posted this question under the “Chart Studies” topic. So there is no perceived purpose for adding an input for x percentage. Had you posted this under “Thinkorswim Scans” or “Alerts and Notifications”, we would have a purpose for that input.

So since we are working out a solution for a Chart Study, about all we can do here is plot the percentage value on a lower subgraph:

declare lower;
def percentChange = 100 * (close / close[1] - 1);
plot data = percentChange;

Marked as spam
Posted by (Questions: 37, Answers: 4087)
Answered on December 5, 2017 10:49 am