Gamestudio Links
Zorro Links
Newest Posts
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
Release 2.68 replacement of the .par format
by Martin_HH. 09/23/25 20:48
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 18,161 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 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,022
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,022
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