Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (PeroPero), 858 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
I want to get the maximum value #475767
01/07/19 15:45
01/07/19 15:45
Joined: Dec 2018
Posts: 22
VN
C
Chuate Offline OP
Newbie
Chuate  Offline OP
Newbie
C

Joined: Dec 2018
Posts: 22
VN
Hello, I want to get the maximum value but the result is so weird. Do you know what is problem ? I can use MaxVal function but I want to use my own function

recent_max_H:5835419512674041400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000

Code:
var test(var *Highs, int Period)
{
	int count;
	var recent_max_H = 0;
	for(count = 1; count < Period; count++)
	{
		if (Highs[count] > recent_max_H) recent_max_H = Highs[count];

	}
	
	printf("nrecent_max_H:%f", recent_max_H);
	return 1;
	

}

function run()
{
	set(PLOTNOW|PARAMETERS);
	StartDate = 20180705;
	EndDate = 20180705;
	BarPeriod = 60;
	LookBack = 3;
	
 

	// create series of highs, closes, lows
	vars Highs = series(priceHigh());
	int Period_Bar = 50;
	if (test(Highs, Period_Bar) == 1)
	{
		enterLong();
	}
	
	
	
	
	
}


Re: I want to get the maximum value [Re: Chuate] #475780
01/07/19 19:28
01/07/19 19:28
Joined: Aug 2017
Posts: 102
Spain
B
Brax Offline
Member
Brax  Offline
Member
B

Joined: Aug 2017
Posts: 102
Spain
For correctly printing float values you must do this:

printf("nrecent_max_H:%f", (var) recent_max_H);

If you set LookBack = 3 and you have BarPeriod = 60, then you are storing in Highs the last three hours of data, so if you try to call test with Period_Bar = 50 you may have problems.

Correct the printf, put LookBack = 50 and try again.

Re: I want to get the maximum value [Re: Brax] #475789
01/08/19 03:49
01/08/19 03:49
Joined: Dec 2018
Posts: 22
VN
C
Chuate Offline OP
Newbie
Chuate  Offline OP
Newbie
C

Joined: Dec 2018
Posts: 22
VN
Originally Posted By: brax
For correctly printing float values you must do this:

printf("nrecent_max_H:%f", (var) recent_max_H);

If you set LookBack = 3 and you have BarPeriod = 60, then you are storing in Highs the last three hours of data, so if you try to call test with Period_Bar = 50 you may have problems.

Correct the printf, put LookBack = 50 and try again.


Thank you for helping. After changing LookBack, it worked laugh


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1