Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (vicknick, howardR, sleakz), 674 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 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: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
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