Gamestudio Links
Zorro Links
Newest Posts
Chat Room for Zorro Programmers
by danatrader. 07/02/20 18:35
Locating unfreed memory
by Dooley. 07/02/20 14:39
A9
by Aku_Aku. 07/02/20 12:43
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 07/02/20 11:11
Help with code
by danatrader. 07/02/20 04:22
Grid Trading - dynamic
by danatrader. 07/01/20 17:15
Fuzzy Range
by AndrewAMD. 07/01/20 16:57
new macro: break_assets
by AndrewAMD. 07/01/20 01:01
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
8 registered members (20BN, 3run, kvm, ozgur, Quad, jenGs, Grat, Ayumi), 427 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
carolthesecond, Roger399, vrindger, XRaf, pchen90
18472 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: 30
Netherlands
G
Grant Offline
Newbie
Grant  Offline
Newbie
G

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

Joined: Aug 2017
Posts: 30
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,012
Chicago
AndrewAMD Offline
Serious User
AndrewAMD  Offline
Serious User

Joined: Feb 2017
Posts: 1,012
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: 30
Netherlands
G
Grant Offline
Newbie
Grant  Offline
Newbie
G

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


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1