Converting a value to a constant or integer - futures io
futures io futures trading

Converting a value to a constant or integer

Discussion in ThinkOrSwim

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

Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

Search this Thread

Converting a value to a constant or integer

(login for full post details)
  #1 (permalink)
Toms River NJ
Posts: 1 since May 2018
Thanks: 0 given, 0 received

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)


Reply With Quote

Can you help answer these questions
from other members on futures io?
Neurological explanations for trading Success
Psychology and Money Management
Automatic pattern research with NT
Elite Algorithmic NinjaTrader Trading
Which kind of Blockvolume is visible? - order processing
Emini and Emicro Index
Webinar: Finding your own way in trading w/Adam Grimes
The Elite Circle
Volume Profile Indicator for Ninja Script in NT8
Best Threads (Most Thanked)
in the last 7 days on futures io
Battlestations: Show us your trading desks!
137 thanks
Big Mike in Ecuador
34 thanks
Want your NinjaTrader indicator created, free?
32 thanks
Saturday Morning Market Replay!
20 thanks
Selling Options on Futures?
19 thanks
(login for full post details)
  #2 (permalink)
San Diego CA
Posts: 7 since Sep 2018
Thanks: 2 given, 0 received

Hi Michael4,

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

Reply With Quote

futures io Trading Community Platforms and Indicators ThinkOrSwim > Converting a value to a constant or integer

Last Updated on September 13, 2018

Upcoming Webinars and Events

NinjaTrader Indicator Challenge!


Battlestations! Show us your trading desk - $1,500 in prizes!


Importance of Finding Your Own Way w/Adam Grimes

Elite only

Journal Challenge w/Jigsaw


Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432,
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.
no new posts