How to count ‘length’ in Highest(high, length)?


Category:
0
0

I’m almost embarassed to ask this question.

If length = 2, does that mean 2 bars before the current bar implying that the current bar is bar 0? One example I saw seemed to indicate the current bar is bar 1 but I doubt it.

Thanks

RESOLVED
Marked as spam
Posted by (Questions: 1, Answers: 2)
Asked on June 27, 2021 5:10 pm
142 views
0
Private answer

The best explanation I can provide is a screenshot that contains a chart study based on the following section of code:

plot data1 = Highest(high, 1);
plot data2 = Highest(high, 2);
plot data3 = Highest(high, 3);

On the screenshot below I have added drawings and annotations that show where each of these three plots appear on the chart.

Notice the plot named "data1" is tracking the high of each and every candle. I feel the best way to understand how the various elements of the Thinkorswim language works is to simply plot them on a chart and play with the values until you fully understand how things work.

But it is also very helpful to check the language reference published by Thinkorswim. The following link explains the Highest() function:

https://tlc.thinkorswim.com/center/reference/thinkScript/Functions/Tech-Analysis/Highest

Once you get your brain wrapped around the code above, the next step is to add an index value to the "high" and see what happens:

plot data1 = Highest(high[1], 1);
plot data2 = Highest(high[1], 2);
plot data3 = Highest(high[1], 3);

Play around with that for a bit and learn how it works. Play is how we learn. Never forget to how to play or you will forget how to learn. All mammals on this planet learn new skills through play. Humans are no different. Sadly, most adults completely forget how to play. But that is a choice. I chose not to forget how to play, and I take time to play all the time. Because I love to learn.

Want to know how to accelerate your learning? Learn how to break things and put them back together.

Marked as spam
Posted by (Questions: 37, Answers: 4084)
Answered on June 27, 2021 6:15 pm