NexusFi: Find Your Edge


Home Menu

 





Converting a value to a constant or integer


Discussion in ThinkOrSwim

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




 
Search this Thread
  #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?
My Rant with AMP Futures
Trading Reviews and Vendors
EA
Platforms and Indicators
No book, only a stair: journaling fills where price move …
Cryptocurrency
requesting .nrd replay files from 2026 spy and qqq
The Elite Circle
RTH vs ETH: when your chart and Volume Profile trading h …
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Mes vs MNQ
6 thanks
NexusFi site changelog and issues/problem reporting
5 thanks
BERN ALGOS algo trading journal
3 thanks
TopStep Trader disappointment
2 thanks
Running trading strategies on a VPS
1 thanks
  #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


© 2026 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 - Downloads - Top
no new posts