Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 664 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
#ifdef - cannot 2 level? #470742
02/05/18 09:39
02/05/18 09:39
Joined: May 2015
Posts: 390
Czech Republic
G
Grat Offline OP
Senior Member
Grat  Offline OP
Senior Member
G

Joined: May 2015
Posts: 390
Czech Republic
Hi,

in this code:
Code:
//#define ALL_SYMBOL
//#define INDEX


#define _LONG 1
#define _SHORT 2
#define _WRONG -999

#define SAVE1 AlgoVar[0]
#define SAVE2 AlgoVar[1]
#define E_TRADE_L AlgoVar[2]
#define E_TRADE_S AlgoVar[3]

#ifdef ALL_SYMBOL
	#define SYMBOLS "EUR/USD","AUD/USD","USD/JPY","USD/CAD","GBP/USD"
	#define SYM1 "AUD/CAD","AUD/CHF","AUD/JPY","AUD/NZD","CAD/JPY","EUR/AUD","EUR/CAD"
	#define SYM2 "EUR/GBP","EUR/JPY","EUR/NZD","GBP/AUD","GBP/JPY","GBP/NZD","NZD/USD"
	#define SYMBOLS SYM1,SYM2,"USD/JPY","GBP/USD","EUR/USD","USD/CAD","AUD/USD"
	#define ALGOS "M15","H1","H4"
	#define BASE 15

#else
	#ifdef INDEX
		#define SYMBOLS "GER30"
		//,"NAS100","SPX500","UK100","US30"
		#define ALGOS "M15"
		#define BASE 5

	#else 
		#define SYMBOLS "EUR/USD"
		#define ALGOS "M15"
		#define BASE 15

	#endif
#endif



SYMBOLS not "EUR/USD" but "GER30". In the preprocessor cannot be included #ifdef inside other?

version: 1.74.8

Last edited by Grat; 02/05/18 09:40.
Re: #ifdef - cannot 2 level? [Re: Grat] #470748
02/05/18 12:08
02/05/18 12:08
Joined: May 2015
Posts: 390
Czech Republic
G
Grat Offline OP
Senior Member
Grat  Offline OP
Senior Member
G

Joined: May 2015
Posts: 390
Czech Republic
code must be rewrite:

Code:
#ifdef INDEX
	#define SYMBOLS "GER30"
	//,"NAS100","SPX500","UK100","US30"
	#define ALGOS "M15"
	#define BASE 5
#endif

#ifdef ALL_SYMBOL
	#define SYM1 "AUD/CAD","AUD/CHF","AUD/JPY","AUD/NZD","CAD/JPY","EUR/AUD","EUR/CAD"
	#define SYM2 "EUR/GBP","EUR/JPY","EUR/NZD","GBP/AUD","GBP/JPY","GBP/NZD","NZD/USD"
	#define SYMBOLS SYM1,SYM2,"USD/JPY","GBP/USD","EUR/USD","USD/CAD","AUD/USD"
	#define ALGOS "M15","H1","H4"
	#define BASE 15

#endif

#ifdef SIMPLE
		#define SYMBOLS "EUR/USD"
		#define ALGOS "M15"
		#define BASE 15

#endif


Re: #ifdef - cannot 2 level? [Re: Grat] #470758
02/05/18 17:59
02/05/18 17:59
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
The C preprocessor allows nested defines. They they are used all the time in lite-C, so you can also use them in scripts.

Re: #ifdef - cannot 2 level? [Re: jcl] #470778
02/06/18 14:17
02/06/18 14:17
Joined: May 2015
Posts: 390
Czech Republic
G
Grat Offline OP
Senior Member
Grat  Offline OP
Senior Member
G

Joined: May 2015
Posts: 390
Czech Republic
Try this, If nothing defined, print GER30 not EUR/USD

Attached Files
test_preprocesor.c (87 downloads)
Test
Re: #ifdef - cannot 2 level? [Re: Grat] #470783
02/06/18 14:38
02/06/18 14:38
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
Try replacing INDEX with GRAT_INDEX wink

When defining something, check in the headers if it is not already defined. Or add your name to any define - then you're on the safe side.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1