You should start by reading the MQL4 documentation, especially the trade functions, as it is completely different to MQL5 (e.g. instead of "PositionsTotal", use OrdersTotal).
However, you will have to change the logic of your code, because MT4 handles things differently from MT5.
Hello,
I want to print the list of symbols having open orders buy,sell and pending orders. I have a MT5 version of code but could not make it working in MT4.
Would very much appreciate if you can help me to convert this code into MT4 version.
Thanks.
//+------------------------------------------------------------------+ //| Haskayafxstubborn goat.mq4 | //| Copyright 2019, Haskaya Software | //| https://www.haskayayazilim.net | //+------------------------------------------------------------------+ #property copyright "Copyright 2019, Haskaya Software" #property link "https://www.haskayayazilim.net" #property version "1.00" #property strict #include <Arrays\ArrayString.mqh> //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ class IntegerSet : public CArrayString { public: bool Add(const string element) { if(this.SearchLinear(element) < 0) return CArrayString::Add(element); return false; } }; void OnTick() { MarketEmirKontrol(); ExpertRemove(); } void MarketEmirKontrol() { IntegerSet MarketEmirler; for(int i=OrdersTotal()-1; i>=0; --i) { if(OrderSelect(i, SELECT_BY_POS)) { MarketEmirler.Add(OrderSymbol()); } } for(int i=MarketEmirler.Total()-1; i>=0; --i) { Print(MarketEmirler.At(i)); //SorgulananEmirler=MarketEmirler.SearchLinear(BekleyenEmirler.At(i)); //Print(SorgulananEmirler," ",BekleyenEmirler.At(i)); } }
https://www.mql5.com/en/forum/370952#comment_22807855
@ Dilchan B M
- 2021.06.09
- www.mql5.com
Thank You!
How can we achieve same in MT5?
How can we achieve same in MT5?
This is the MT4 section.
Please don't confuse issues by asking about MT5.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
I want to print the list of symbols having open orders buy,sell and pending orders. I have a MT5 version of code but could not make it working in MT4.
Would very much appreciate if you can help me to convert this code into MT4 version.
Thanks.