Jump to content

[REQ] Problem with this code


Recommended Posts

Hello,

I have changed the following code from

 

if (StringLen(Symbol())== 7 )
  {
     Symbol1 = Symbol1 + "b";
     Symbol2 = Symbol2 + "b";
     Bollinger_Symbol = Bollinger_Symbol + "b";
     USD = USD + "b";
  }

  if (StringLen(Symbol())== 9 )
  {
     Symbol1 = Symbol1 + "jfx";
     Symbol2 = Symbol2 + "jfx";
     Bollinger_Symbol = Bollinger_Symbol + "jfx";
     USD = USD + "jfx";
  }

 

to

 

if (StringLen(Symbol())== 7 )
  {
     Symbol1 = Symbol1 + Appendix1;
     Symbol2 = Symbol2 + Appendix1;
     Bollinger_Symbol = Bollinger_Symbol + Appendix1;
     USD = USD + Appendix1;
  }

  if (StringLen(Symbol())== 9 )
  {
     Symbol1 = Symbol1 + Appendix3;
     Symbol2 = Symbol2 + Appendix3;
     Bollinger_Symbol = Bollinger_Symbol + "Appendix3;
     USD = USD + Appendix3;
  }

 

And have added the following extern strings:

extern string     Appendix1           = "b";
extern string     Appendix3           = "jfx";

 

And now I do always get the message "Please enable all pairs on Market Watch Window"!

What have I done wrong, because before I changed it the code it worked well.

But with an extern string it is easier to change the appendix of pairs.

 

Hope someone has a hint ;-)

 

The complete EA is here:

http://depositfiles.com/files/k8siu9o49

 

And I have tried it with BeamFX

http://www.beamfx.com/metatrader/BeamFXMT4.exe

 

thx in advance

newbee

Link to comment
Share on other sites

Re: [REQ] Problem with this code

 

Well, starting another thread may not be the best way to solve the same problem. But oh well.

If your first part of the code does not work, your changes will not work as well...

 

I would suggest not to work with "adding" suffices but rather "remove" them and focus on the pair itself in your code.

Also see here: http://docs.mql4.com/strings/StringSubstr

 

So:

 

Symbol1 = Symbol();
Symbol1 = StringSubStr(Symbol1, 0,6);

 

I am just not sure why you want to keep the suffices in your code. Using StringSubstr() will allow this to work for any broker, regardless of suffices. Moreover, the code that birt posted in your other thread will work for any broker...regardless of suffices/prefixes.

Thanks for the kudos...much appreciated!
Link to comment
Share on other sites

Re: [REQ] Problem with this code

 

Well, starting another thread may not be the best way to solve the same problem. But oh well.

If your first part of the code does not work, your changes will not work as well...

 

The first code was working before I changed it and added the extern string.

 

I would suggest not to work with "adding" suffices but rather "remove" them and focus on the pair itself in your code.

Also see here: http://docs.mql4.com/strings/StringSubstr

 

So:

 

Symbol1 = Symbol();
Symbol1 = StringSubStr(Symbol1, 0,6);

Do I only have to add the code or do I have to enter this for another one?

And does this solve the problem with pairs like GBPUSD*, GBPUSD** and GBPUSD***?

 

-- 21 Mar 2010, 18:54 --

 

Is there any coding expert, who can help me to get this EA to work on any pairs, even those with GBPUSDm or GBPUSDjfx at the end?

Would be great.

 

-- 22 Mar 2010, 21:56 --

 

Problem is solved, many thx to birt in another thread ;-)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...