Maximum/Minimum Functions

Studies that have been contributed to the community by other users. If you’ve got something useful to share, that’s great!
black phil
Posts: 2
Joined: 08 Jun 2010

Maximum/Minimum Functions

Postby black phil » 08 Jun 2010

Hi,

Looking for functions that select the minimum or maximum of two
variables. (not Highest function which selects highest of a series).

:)

User avatar
TJ
Posts: 6523
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 957 times
Been thanked: 1883 times

Re: Maximum/Minimum Functions

Postby TJ » 08 Jun 2010

Hi,

Looking for functions that select the minimum or maximum of two
variables. (not Highest function which selects highest of a series).

:)


Maxlist

Minlist

k-hen
Posts: 8
Joined: 08 Dec 2009

Postby k-hen » 16 Jun 2010

If you're looking for a max between variables then you can create a new function, call it Max as returning numeric and simple function storage. Then paste this in the code section:

Code: Select all

inputs: v1(numericsimple), v2(numericsimple);
Max = iff(v1>=v2,v1,v2);

and compile ... you can then use the function like this:

Code: Select all

variables: mv1(3), mv2(2);

value1 = Max(mv1,mv2);
print("value1: "+ NumToStr(value1,0));


Return to “User Contributed Studies and Indicator Library”