how to edit Symbol() - page 2

 

Hello Brian ...

You did a mistake ...

 Just replace "Symbol()!=symb" by "symb" in the OrderSend( ) without using " " ...

Let me know how it goes ... 

 
Marco vd Heijden:

Always refers to the chart symbol.

If you want to use another symbol

Replace

with

Where X is the symbol integer from Marketwatch position.

Also realize that you can not use Ask and Bid because these also relate to the chart Symbol so use

Instead.

is this code for mq4 or mq5 or both?
 
bah12ram:
is this code for mq4 or mq5 or both?
To MQL4 since your original code is too.
 
Marco vd Heijden:
To MQL4 since your original code is too.
Thanks Marco
 
Osama Shaban:

Hello Brian ...

You did a mistake ...

 Just replace "Symbol()!=symb" by "symb" in the OrderSend( ) without using " " ...

Let me know how it goes ... 

Hi Osama

Thank you very much for all your help.

That worked perfectly.

Regards,

 

Let me summarize what I told you before ...

Once you enforce the EA to use Symb = "EURUSD" then it will not make any effect anywhere in the code if

you use Symb or "EURUSD" instead. The only importand line that must use "EURUSD" as the only allowed sybmol to

trade is the OrderSend ( ) function as it is the responsible one for opening the EURUSD order. 

 

You may use ...

extern string Symb = "EURUSD";

or,

input string Symb = "EURUSD";

 In case you want to display a custom text instead of "Symb" ... Just do the following ...

input string Symb = "EURUSD";    //Allow to Trade only this Pair ...

 So, you will get the text "Allow to Trade only this Pair ..." instead of Symb while the code will use Symb itself.

 

Good luck ... 

Reason: