Gamestudio Links
Zorro Links
Newest Posts
Ally Invest Can't Connect
by beo. 04/04/20 02:00
Clearing log window
by jbhunter. 04/04/20 00:58
SierraChart Plugin msg type:140
by tradingest. 04/03/20 21:21
MT4 bridge: Check account number
by tradingest. 04/03/20 21:19
Slowness after update
by Leohermoso. 04/03/20 16:45
Imgui Lite-c Development
by Evo. 04/03/20 14:50
printf() not printing when RULES is set
by sdh309795gaas. 04/03/20 13:07
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
6 registered members (beo, AndrewAMD, mey, Zheka, jbhunter, 3run), 657 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
beo, marsz, gonzalez21, Cobus, HF_Psy
18411 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: 905
Chicago
AndrewAMD Online
User
AndrewAMD  Online
User

Joined: Feb 2017
Posts: 905
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: 905
Chicago
AndrewAMD Online
User
AndrewAMD  Online
User

Joined: Feb 2017
Posts: 905
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?


Powered by UBB.threads™ PHP Forum Software 7.7.1