Gamestudio Links
Zorro Links
Newest Posts
Strange "Alien" Skull created with >Knubber<
by NeoDumont. 04/10/26 18:58
400 free seamless texture pack downl. here !
by NeoDumont. 04/08/26 19:55
ZorroGPT
by TipmyPip. 04/08/26 17:08
TMFs on options in live trading
by Spirit. 03/26/26 19:52
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
1 registered members (Grant), 4,161 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
ondrej, mredit, vestriaa, Lukudo, mldenoiser
19205 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Arrays #473664
08/02/18 15:20
08/02/18 15:20
Joined: Aug 2018
Posts: 12
T
Tavasy Offline OP
Newbie
Tavasy  Offline OP
Newbie
T

Joined: Aug 2018
Posts: 12
Hi all


I posted this on the wrong section earlier

I am trying to get maximum and minimum values from an array. Am I doing it right? The maximum and minimum values are always the same. Is there a function like MQL's ArrayMaximum or ArrayMinimum? Heres is the code below

function tick()
{
var BidPrice = AskPrice - Spread;



var a[50];

var mini = 200;
var maxi = 0;

a[0]=BidPrice ;
mini = a[0];
int i;
for (i=1;i<50;i++)
{
a[i] = BidPrice ;

printf("n %f", a[i]);
if (a[i] > maxi)
{
maxi = a[i];
}
if (a[i] < mini)
{
mini = a[i];
}
}

Re: Arrays [Re: Tavasy] #473670
08/03/18 14:42
08/03/18 14:42
Joined: Jul 2000
Posts: 28,091
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,091
Frankfurt
You're not doing it right, but you need not code it anyway - Zorro has already functions for all array statistics, MaxVal and MinVal in this case.

Re: Arrays [Re: jcl] #473679
08/03/18 18:39
08/03/18 18:39
Joined: Aug 2018
Posts: 12
T
Tavasy Offline OP
Newbie
Tavasy  Offline OP
Newbie
T

Joined: Aug 2018
Posts: 12
Thank you very much


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1