Gamestudio Links
Zorro Links
Newest Posts
Removing outliers from files
by AndrewAMD. 12/02/26 15:26
SGT_FW
by Aku_Aku. 11/30/26 08:19
Experiences with cTrader
by JeyKey II. 11/27/26 09:04
make a complaint
by EW_bytes. 11/26/26 23:00
FXCM => AVA Trade Plugin???
by Martin_HH. 11/25/26 21:59
No connection to MT4
by Martin_HH. 11/23/26 06:38
MinMax function on History t6 file
by LucasJoshua. 11/21/26 14:28
What are you working on?
by rayp. 11/20/26 18:10
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
3 registered members (AndrewAMD, Quad, Grant), 8,062 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EvanTJ, rht, MaliceTheMaker, Haitao_Ren, JimSimons
19250 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,840
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

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

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