Your function only counts for the chart symbol.
If you want to call for other symbols you have to pass the name of the symbol as a parameter.
void UpdatePosition(string symbol) { //extern int tradecount =0; posType = OP_FLAT; posTicket = 0; posLots = 0; int total = OrdersTotal(); for(int pos=total-1; pos>=tradecont-1; pos--) { if(OrderSelect(pos,SELECT_BY_POS,MODE_TRADES) && OrderSymbol()==symbol && OrderMagicNumber()==Magic_Number) { posType = OrderType(); posLots = OrderLots(); posTicket = OrderTicket(); posStopLoss = OrderStopLoss(); posTakeProfit = OrderTakeProfit(); break;} } }It's still not right you can make it into a interger then it will return the number of open orders for each symbol separately.
Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
- www.mql5.com
//| Expert initialization function | //| Expert deinitialization function | //| Expert tick function | //| test1 |...
I can not make it
I'm really denied about this, I just can't
I know that it is not obvious, but topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.
I will move your topic to the MQL4 and Metatrader 4 section.
Keith Watford:
I know that it is not obvious, but topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.
I will move your topic to the MQL4 and Metatrader 4 section.
I'm sorry it's the first time I post, thanks
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
hi everyone I have a problem, I can't enter the total order count on a single Symbol, I would like to enter it for each Symbol but I can't find a way, I'm not very good at coding but I've been searching for 1 day
I don't know if I'm wrong the magic number or the for cycle, but I can't get what I want, I can have a total of orders open, but not for every single Symbol
Writing this code I can limit the operations of the whole market but not only of a Symbol
I can't understand what I'm wrong, I want to make sure that I can decide how many operations to open on each symbol