Reply

Lets make an Automatic Unique MagicNumber for each strategy in our portfolio!

7 replies

Karish

Customer, bbp_participant, community, sq-ultimate, 443 replies.

Visit profile

6 years ago #195927

So…,
As you all already know when you do have a portfolio SQ3 does not give you the option to create some kind of file with all the rules of the strategies that are inside the portfolio so that MT4 could read from that file and we wont need to have 100 windows opened inside MT4 with EAs..

So.. until SQ4 will be ready with some kind of feature like that,
we can make our life better by cutting off some part of our manual work while we are ready to trade our portfolio,

This topic will be focusing on how to make our work more efficient and less manual and more automatic,

i would like to get some help for you guys that have some coding knowledge,

i think the first thing we have to do is an Automatic Unique MagicNumber,
i am not that of an expert and i would like to get some help with building this,
my idea is to get the name of the EA file which is for example: “Strategy 4.222.”
take off the string “Strategy” + the string “.” so we would have only an Integer of “4222”,
thats it :), i just dont know how to do it and i would like to have some help and it would be publicly shared with the members :),

later on we can continue to improve and cut off parts of our “exporting & trading the portfolio” workflow.
thank you for your participation and help 🙂

0

Karish

Customer, bbp_participant, community, sq-ultimate, 443 replies.

Visit profile

6 years ago #195978

NVM already solved it thanks @notch,
my share to you guys:

string Numerics_only(string numstring){int iPos=0;while(iPos < StringLen(numstring)){string c = StringSubstr(numstring, iPos, 1);if(c < “0” || c > “9”) StringReplace(numstring, c, “”);else ++iPos;}return Numerics_only;}
string EAName=WindowExpertName();
int MagicNumber = Numerics_only(EAName);
string CustomComment = EAName+”_”+MagicNumber;

0

Karish

Customer, bbp_participant, community, sq-ultimate, 443 replies.

Visit profile

6 years ago #196026

Shit… cant edit in that new forum design.., damn should have keep the option to use the older forum, they had so many simple options there..

here is the full code, Forget about changing MagicNumbers ever again!:

string Numerics_only(string stringtonum){
int iPos=0;
while(iPos < StringLen(stringtonum)){
string c = StringSubstr(stringtonum, iPos, 1);
if(c < “0” || c > “9”) StringReplace(stringtonum, c, “”);
else ++iPos;
}
return stringtonum;
}
string EAName=WindowExpertName();
int MagicNumber = Numerics_only(EAName);

*** REPLACE THE OLDER “MagicNumber” PARAMETER THAT ALREADY EXIST WITH THIS WHOLE FUNCTION.
HAVE FUN!

0

cullo6

Customer, bbp_participant, community, 0 replies.

Visit profile

6 years ago #197223

Hi Karish, where I must replace the older magicnumber parameter with this new one? In which file?

0

Karish

Customer, bbp_participant, community, sq-ultimate, 443 replies.

Visit profile

6 years ago #197231

Hi Karish, where I must replace the older magicnumber parameter with this new one? In which file?

find “extern int MagicNumber=” and replace it,
all code related files are inside the “Code” folder.

0

cullo6

Customer, bbp_participant, community, 0 replies.

Visit profile

6 years ago #197242

I done it, but thinked, that I’m doing it wrong. Nevertheless thanks.

0

cullo6

Customer, bbp_participant, community, 0 replies.

Visit profile

6 years ago #197455

Hi Karish, where I must replace the older magicnumber parameter with this new one? In which file?

find “extern int MagicNumber=” and replace it,
all code related files are inside the “Code” folder.

Hi Karish, it does not work for me. First it does not compile, because of these quotes “ in: if(c < “0” || c > “9”) StringReplace(stringtonum, c, “”);, so I replaced all of them with this ones “. But it does not work, strategies open orders with magic num. 0. Can you help me? I also tried other changes of this line of code, but without success. Thanks.

0

Karish

Customer, bbp_participant, community, sq-ultimate, 443 replies.

Visit profile

6 years ago #197459

string Numerics_only(string stringtonum){
int iPos=0;
while(iPos < StringLen(stringtonum)){
string c = StringSubstr(stringtonum, iPos, 1);
if(c < “0” || c > “9”) StringReplace(stringtonum, c, “”);
else ++iPos;
}
return stringtonum;
}
string EAName=WindowExpertName();
int MagicNumber = Numerics_only(EAName);
string CustomComment = EAName+”_”+MagicNumber;

try this one, working fine for me.

0

Viewing 7 replies - 1 through 7 (of 7 total)