Autodidact's Paradox
New member
My intent is to build a scan that looks at the past 12 months (starting at the present day, not necessarily going by calendar months) but excludes data from the most recent month. If we denote the oldest month as "Month12" and the most recent month as "Month0" (where the present day is the close of Month0), and if we are using the closing price ($) at month end, then we have the equation:
M = Month()
R = Return()
R(M(X)) = ((close[M(X+1)] - close[M(X)])/close[M(X+1)])+1
where X is an integer such that 0 < X < 12
X = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11; letting us look back 12 months, but pulls 11 months of data, excluding the most recent month
*to clarify, if needed: the NYSE is open an average of 252 days per year, so I figure 252/12 = 21 days = 1 trading month. If the close of Month0 is today, then we have the close of Month1 being 21 days ago, the close of Month2 being 42 days ago, etc. I would like to use this more specific measure of 1 trading month if possible; if not, ToS's default time length of 1 month will do.
*I prefer to measure price changes from close to close instead of from open to close, as open to close excludes any overnight price action that occurs between intervals
From there, I would like to calculate the 11 month cumulative return, which can be expressed as (or in another way if better/more understandable):
R(Cumulative) = R(M(11))*R(M(10))*R(M(9))*R(M(8))*R(M(7))*R(M(6))*R(M(5))*R(M(4))*R(M(3))*R(M(2))*R(M(1))
I would like to use this as a Scan that returns securities with the highest R(Cumulative) value.
I've made several attempts at coding this up, but having difficulty even after referencing anything/everything I can find via colleagues and online searches. I'm newer to ToS and ThinkScripts, doing all I can to bludgeon through this, so any/all help would be vastly appreciated and would definitely encourage me to reciprocate once I'm further along the learning and experience curves.
Kindest Regards.
M = Month()
R = Return()
R(M(X)) = ((close[M(X+1)] - close[M(X)])/close[M(X+1)])+1
where X is an integer such that 0 < X < 12
X = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11; letting us look back 12 months, but pulls 11 months of data, excluding the most recent month
*to clarify, if needed: the NYSE is open an average of 252 days per year, so I figure 252/12 = 21 days = 1 trading month. If the close of Month0 is today, then we have the close of Month1 being 21 days ago, the close of Month2 being 42 days ago, etc. I would like to use this more specific measure of 1 trading month if possible; if not, ToS's default time length of 1 month will do.
*I prefer to measure price changes from close to close instead of from open to close, as open to close excludes any overnight price action that occurs between intervals
From there, I would like to calculate the 11 month cumulative return, which can be expressed as (or in another way if better/more understandable):
R(Cumulative) = R(M(11))*R(M(10))*R(M(9))*R(M(8))*R(M(7))*R(M(6))*R(M(5))*R(M(4))*R(M(3))*R(M(2))*R(M(1))
I would like to use this as a Scan that returns securities with the highest R(Cumulative) value.
I've made several attempts at coding this up, but having difficulty even after referencing anything/everything I can find via colleagues and online searches. I'm newer to ToS and ThinkScripts, doing all I can to bludgeon through this, so any/all help would be vastly appreciated and would definitely encourage me to reciprocate once I'm further along the learning and experience curves.
Kindest Regards.