Symbol()
Always refers to the chart symbol.
If you want to use another symbol
Replace
Symbol()
with
SymbolName(X,1)
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
MarketInfo(SymbolName(X,1),MODE_ASK)
MarketInfo(SymbolName(X,1),MODE_BID)
Instead.
The EA runs on that chart you put it to. So when you put it only on EURUSD chart it only trades on that symbol.
Hi Daniela,
Thanks for your reply.
I actually want it not to run on any chart. I would like to restrict it to charts that I select.
Thanks.
Regards,
B
The EA runs on that chart you put it to. So when you put it only on EURUSD chart it only trades on that symbol.
Thanks Marco,
Will try that and let you know how I do:)
Cheers,
Brian
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.
Thanks Marco,
Will try that and let you know how I do:)
Cheers,
Brian
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.
Hi Marco,
Just to be clear, anywhere that Symbol() appears in the code will have to be changed in the way that you suggest or is there a way to do a single change that will apply to all instances of Symbol() in the EA
Thanks again. Excuse my rookie question.
Regards,
B
input ... input ... input ... string symb = "EURUSD"; //This will not shown in the EA external settings ! int start(){ if(Symbol() != symb) return(0); ... ... ... }
I believe the above code will to what you are looking for ...
Just be sure that symbol between " " is the same as used by your broker.
I believe the above code will to what you are looking for ...
Just be sure that symbol between " " is the same as used by your broker.
Hi Osama,
Thanks for your reply.
So in my original example above it would loook like this:
RefreshRates(); if (takeprofit != 0) ticket_buy = OrderSend(Symbol()!=symb,OP_BUY,lotsize,Ask,slippage,Ask-atp*pp*Point,Ask+takeprofit*pp*Point,"buy",magic_number,0,Aqua); else ticket_buy = OrderSend(Symbol()!=symb,OP_BUY,lotsize,Ask,slippage,Ask-atp*pp*Point,0,"buy",magic_number,0,Aqua); }
I have done this everywhere in the code where Symbol() appears and then ran Strategy Tester. The EA should open the first order when it hits a trend line but it stops as soon as it hits the trend line.
I also used this as the input:
string symb = "EURUSD";
Can you perhaps see where I made a mistake?
Thanks.
Regards,
Brian

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I am editing an old EA that was coded for so I can try learn to code.
I assume Symbol() in the code below means the EA will work with any symbol.
I was wondering how to change this so that this EA will only run on a specific symbol or symbols?
I'm assuming I need to create a symbol "input" where I could choose my symbol?
Could someone perhaps show me how this would be done?
This particular EA was coded BEFORE the big MT4 upgrade.
Appreciate any help.
Regards,
B