Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 666 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How to check when live or demo in script? #478563
11/09/19 15:39
11/09/19 15:39
Joined: Nov 2019
Posts: 2
M
Mr_Rob Offline OP
Guest
Mr_Rob  Offline OP
Guest
M

Joined: Nov 2019
Posts: 2
I want to be able to send my .x script for others to test. I want it to only work in demo mode. If tried to go live, It will execute the quit() function.

Tried browsing the manual but couldn't find what I was looking for.

Any ideas on how to get zorro to know if its in live mode or demo mode? if live, then quit();

Re: How to check when live or demo in script? [Re: Mr_Rob] #478564
11/09/19 16:15
11/09/19 16:15
Joined: Aug 2017
Posts: 294
Netherlands
G
Grant Offline
Member
Grant  Offline
Member
G

Joined: Aug 2017
Posts: 294
Netherlands
By using the DEMO status flag like:
Code
if(is(!DEMO)) 
    {
    quit();
    }



Last edited by Grant; 11/09/19 16:16.
Re: How to check when live or demo in script? [Re: Grant] #478565
11/09/19 17:00
11/09/19 17:00
Joined: Nov 2019
Posts: 2
M
Mr_Rob Offline OP
Guest
Mr_Rob  Offline OP
Guest
M

Joined: Nov 2019
Posts: 2
Originally Posted by Grant
By using the DEMO status flag like:
Code
if(is(!DEMO)) 
    {
    quit();
    }




I'll give this try. I'm curious if this will interfere with backtesting as it will neither be live nor demo

Re: How to check when live or demo in script? [Re: Mr_Rob] #478566
11/09/19 17:12
11/09/19 17:12
Joined: Aug 2017
Posts: 294
Netherlands
G
Grant Offline
Member
Grant  Offline
Member
G

Joined: Aug 2017
Posts: 294
Netherlands
It's only account related, so it should work laugh

Re: How to check when live or demo in script? [Re: Mr_Rob] #478567
11/09/19 17:23
11/09/19 17:23
Joined: Feb 2017
Posts: 1,725
Chicago
AndrewAMD Offline
Serious User
AndrewAMD  Offline
Serious User

Joined: Feb 2017
Posts: 1,725
Chicago
It should **not** work because the exclamation point "!" is in the wrong place!

Before:
Code
if(is(!DEMO)) 
    {
    quit();
    }
After:
Code
if(!is(DEMO)) 
    {
    quit();
    }


Here's a better code sample:
Code
void run(){
	if(is(DEMO)){
		printf("\nDEMO flag is ON");
	}
	else{
		printf("\nDEMO flag is OFF");
	}
	quit("#Done.");
}


Also, the description of DEMO is:
Quote
A demo account is selected through the [Account] scrollbox.
It does not care what mode you are in.

Re: How to check when live or demo in script? [Re: Mr_Rob] #478568
11/09/19 19:10
11/09/19 19:10
Joined: Aug 2017
Posts: 294
Netherlands
G
Grant Offline
Member
Grant  Offline
Member
G

Joined: Aug 2017
Posts: 294
Netherlands
My bad, thanks!


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1