NexusFi: Find Your Edge


Home Menu

 





Converting a value to a constant or integer


Discussion in ThinkOrSwim

Updated
    1. trending_up 2,456 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 1 posts
    2. attach_file 0 attachments




 
Search this Thread

Converting a value to a constant or integer

  #1 (permalink)
Michael4
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!

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
What broker to use for trading palladium futures
Commodities
How to apply profiles
Traders Hideout
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Better Renko Gaps
The Elite Circle
MC PL editor upgrade
MultiCharts
 
  #2 (permalink)
scotch
San Diego CA
 
Posts: 7 since Sep 2018
Thanks Given: 2
Thanks Received: 0

Hi Michael4,

Did you get this sorted out? I'm wondering the same thing right now.

Reply With Quote




Last Updated on September 13, 2018


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts