Gamestudio Links
Zorro Links
Newest Posts
Bmap creation - wrong Alpha values
by txesmi. 12/11/19 12:43
A9
by preacherX. 12/11/19 11:01
Error Message 010: invalid stops
by Volker. 12/11/19 08:25
AssetFix & Assets.csv
by MatPed. 12/11/19 07:03
How to handle profit in a TMF during training
by StefanCGN. 12/09/19 20:09
Simulate complex commission costs [Test]
by AndrewAMD. 12/09/19 13:52
AUM Magazine
Latest Screens
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Who's Online Now
6 registered members (3run, AndrewAMD, Volker, Quad, PabloMF, 1 invisible), 802 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
timW, PabloMF, deepscreener, wzschultz, Alit
18342 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: 25
Netherlands
G
Grant Offline
Newbie
Grant  Offline
Newbie
G

Joined: Aug 2017
Posts: 25
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: 25
Netherlands
G
Grant Offline
Newbie
Grant  Offline
Newbie
G

Joined: Aug 2017
Posts: 25
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: 816
Chicago
AndrewAMD Online
User
AndrewAMD  Online
User

Joined: Feb 2017
Posts: 816
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: 25
Netherlands
G
Grant Offline
Newbie
Grant  Offline
Newbie
G

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


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