Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, TedMar, dr_panther), 1,049 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
is(FIRSTRUN) #451651
05/15/15 06:36
05/15/15 06:36
Joined: Feb 2015
Posts: 11
C
chirpydog Offline OP
Newbie
chirpydog  Offline OP
Newbie
C

Joined: Feb 2015
Posts: 11
hello all,

i am trying to write a function to perform some calculations of the highs and lows of the last X bars.. This function only needs to run once at the beginning after price data and system variables ... My questions are

1. how to use flag FIRSTRUN ? i have compiling error 'FIRSTRUN' undeclared identifier for the following script

if is(FIRSTRUN) printf ("Today is friday");

2. Does it work if i declare an int variable and use it to loop through the numbers of bars ?

Eg.

int z;
for (z=0;z<11;z++) { if priceHigh(z)<priceHigh(z+1) s1=priceHigh(z+1) }

Many thanks !

Re: is(FIRSTRUN) [Re: chirpydog] #451652
05/15/15 07:51
05/15/15 07:51
Joined: Sep 2007
Posts: 101
Luxembourg
K
krial057 Offline
Member
krial057  Offline
Member
K

Joined: Sep 2007
Posts: 101
Luxembourg
For fixing your syntax errors, you need to put the conditions of the if in parenthesis:
Php Code:
if(is(FIRSTRUN))
  printf ("Today is friday"); 




and

Php Code:
int z;
for (z=0;z<11;z++) { 
  if(priceHigh(z)<priceHigh(z+1))
	s1=priceHigh(z+1) ;
} 




the for loop should work.

kind regards,

Alain

Last edited by krial057; 05/15/15 07:55.
Re: is(FIRSTRUN) [Re: krial057] #451656
05/15/15 12:37
05/15/15 12:37
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
FIRSTRUN was for a beta version only - it is not yet defined in your Zorro version. For checking which flags your version has, click Help and look up "mode".

You can use the Bar variable for determining FIRSTRUN. It's the first run with Bar > 0.

Re: is(FIRSTRUN) [Re: krial057] #451728
05/18/15 11:45
05/18/15 11:45
Joined: Feb 2015
Posts: 11
C
chirpydog Offline OP
Newbie
chirpydog  Offline OP
Newbie
C

Joined: Feb 2015
Posts: 11
Thanks Alain

Re: is(FIRSTRUN) [Re: jcl] #451729
05/18/15 11:50
05/18/15 11:50
Joined: Feb 2015
Posts: 11
C
chirpydog Offline OP
Newbie
chirpydog  Offline OP
Newbie
C

Joined: Feb 2015
Posts: 11
Thanks jcl..

so to run the function once only after price data would be

if Bar=1 {function here..} ??

Re: is(FIRSTRUN) [Re: chirpydog] #451730
05/18/15 13:39
05/18/15 13:39
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline
Serious User
DLively  Offline
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
As I usually mention I do not use Zorro, but being helpful as I am, I just wanted help you with your programming in general:

remember this is comparing (==) if(this==this){return;}

And this is assigning (=) x = 1;

Also as Krial057 said, Don't forget the parenthesis() around your if statement laugh

Last edited by DLively; 05/18/15 14:48.

A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: is(FIRSTRUN) [Re: DLively] #451731
05/18/15 14:53
05/18/15 14:53
Joined: Feb 2015
Posts: 11
C
chirpydog Offline OP
Newbie
chirpydog  Offline OP
Newbie
C

Joined: Feb 2015
Posts: 11
Thanks DLively..

Yes that was my quick shot to clarify the logic... omitting the syntax..

will take note..


Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1