Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (opm), 778 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
String fast question #477671
07/20/19 21:29
07/20/19 21:29
Joined: Jul 2019
Posts: 26
M
maxwellreturn Offline OP
Newbie
maxwellreturn  Offline OP
Newbie
M

Joined: Jul 2019
Posts: 26
Hi all, sorry for my dumb question laugh
how can i get a string from a variable for use it in the text editor. For example:
Code
string x = "SMA";
vars MA = series(x(priceClose(), 100));


PS. without using "#define x SMA", only with string var.
Thanks

Last edited by maxwellreturn; 07/20/19 21:36.
Re: String fast question [Re: maxwellreturn] #477672
07/20/19 22:22
07/20/19 22:22
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Offline
Serious User
AndrewAMD  Offline
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
Your choices are:
* Use a macro
* Use a function pointer
* Have the string as an argument for a wrapper function.

Take your pick.

Re: String fast question [Re: maxwellreturn] #477676
07/21/19 06:23
07/21/19 06:23
Joined: Jul 2019
Posts: 26
M
maxwellreturn Offline OP
Newbie
maxwellreturn  Offline OP
Newbie
M

Joined: Jul 2019
Posts: 26
hi andrew thanks for your answer, can you give me examples for every choice?

Re: String fast question [Re: maxwellreturn] #477681
07/21/19 15:49
07/21/19 15:49
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Offline
Serious User
AndrewAMD  Offline
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
There is an excellent example of how to do this. Read this blog article by jcl:
https://financial-hacker.com/trend-and-exploiting-it/

The function filter() is redefined many times in a large scale test, using batch scripting. Definitely give it a look.

Re: String fast question [Re: AndrewAMD] #477684
07/21/19 16:56
07/21/19 16:56
Joined: Jul 2019
Posts: 26
M
maxwellreturn Offline OP
Newbie
maxwellreturn  Offline OP
Newbie
M

Joined: Jul 2019
Posts: 26
thank you andrew this is an elegant solution. i think with this you refere to your third choice, the "wrapper function". Can i ask you for the second choice how can i pratically do it?


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1