Gamestudio Links
Zorro Links
Newest Posts
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Data from CSV not parsed correctly
by EternallyCurious. 04/25/24 10:20
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
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (EternallyCurious, TipmyPip, Quad, AndrewAMD), 904 guests, and 7 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
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,725
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,725
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,725
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,725
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