Toms River NJ
Posts: 1 since May 2018
Thanks Given: 0
Thanks Received: 0
|
Hopefully someone can help me with this. I have programming experience, but am fairly new with the ThinkorSwim platform. Maybe there is even a simple function to do what I am trying to do, but I can't find it.
I'm simply trying to find the position (number of bars) of the "high" of any value within a certain time period, then find the position of the second "high" within the range of now and when the first high was found.
So let's say I want to find the highest RSI in a 50 period range, then once that is found, (say on 32 bars back), I would like to find the highest RSI within 32 bars (from the point the first high was found).
The start of my code goes like this...
def period=50;
def MaxRSIvalue = Highest(RSI()."RSI", period);
def MaxRSIpos =Getmaxvalueoffset(RSI()."RSI", period);
def MaxRSIvalue2 = Highest(RSI()."RSI", MaxRSIpos);
However, on the 4th line down, I get the error...
"Only constants expected here: MaxRSIpos CL constant function parameter 'length' at 4:40"
The problem I think is that the "Highest" function requires a constant or integer value in "length", and the value returned with the position from the "Getmaxvalueoffset" function contains a decimal for some reason.
TLDR: The bottom line is, is there any want to take the value from the "Getmaxvalueoffset" function and convert it into a constant or integer to be used in the "Highest" function?
(sorry if that was a little long)
Thanks!
|