Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
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 for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Hi, I was wondering if you have the answer to my scripting question....
For thinkscript.
So I have several different defs,
and I want the one with highest value to be defined in another one...
def a = if true 1 else 0
def b = if true 2 else 0
def c = if true 3 else 0
def d = if true 4 else 0
def result = max(a b c d)
at this point we would get d because its got the highest value... as you know thinkscript will only do this with 2 values.
anyway you would know a workaround? Thanks.
Can you help answer these questions from other members on NexusFi?
Thanks growex, that answered my question. Only thing now, as we got D, how do I get the actual value for D? the def of D was given... but I didn't know the value would not be given. I wanted the number instead in this case we can see that the THEN value is 4. That is what I want...... the then part.
Thanks in advance!
def a = if true 1 else 0
def b = if true 2 else 0
def c = if true 3 else 0
def d = if true 4 else 0
def result = max(max(max(a,b),c),d);
the value of "result" variable will be 4, not "D";
just for information....to assign text values use ""
def a = "a";
def a = "/es"
also if you want to name your variables such as 1a,1b,1c (name starts witn a number) use "" also