♥ 0 |
Hellow mr Hahn i have a small line of code i need created. Its a simple “plot scan” script as down below, but the kicker is that i need you to create a code plotting the frequency of the true values over a look back period of X bars. For example Plot Scan = DataH5 is true
Marked as spam
|
Private answer
We can do this will a single line of code. The first thing to understand is that in Thinkscript, a True value = 1 and a False value = 0. Armed with this knowledge, we can use the Sum() function to add together the 1’s and 0’s over the specified ‘lookback’ period (in this example a lookback period of 10 bars).
Since we don’t see the rest of the code, we must assume that your DataH5 variable is defined in an earlier statement. We don’t really need the “plot scan” statement at all. We can simply do this:
You can read more about the Sum() function here: http://toslc.thinkorswim.com/center/reference/thinkScript/Functions/Math—Trig/Sum.html Marked as spam
|
Please log in to post questions.