Dilchan B M:
Dear Experts,
I want to get distinct list of symbols which has open or pending orders.
My code is giving me the list of only open positions.
Can you help me with modification so that it would get the symbols of both open and pending orders.
Thank you in Advance!
//+------------------------------------------------------------------+ //| 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> #include <Trade\PositionInfo.mqh> #include <Trade\HistoryOrderInfo.mqh> #include <Trade\DealInfo.mqh> CPositionInfo Position; CHistoryOrderInfo History; CDealInfo Deal; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ 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; // Market Orders int total=PositionsTotal(); for(int i=0; i<total; i++) { string position_symbol=PositionGetSymbol(i); // MarketEmirler.Add(PositionGetSymbol(i)); } // Pending Ordes int o_total=OrdersTotal(); for(int j=o_total-1; j>=0; j--) { ulong o_ticket = OrderGetTicket(j); string abs=OrderGetString(ORDER_SYMBOL); MarketEmirler.Add(OrderGetString(ORDER_SYMBOL)); } //SorgulananEmirler=MarketEmirler.SearchLinear(BekleyenEmirler.At(i)); //Print(SorgulananEmirler," ",BekleyenEmirler.At(i)); for(int i=MarketEmirler.Total()-1; i>=0; --i) { Print(i," Symbol ",MarketEmirler.At(i)); } }

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
Dear Experts,
I want to get distinct list of symbols which has open or pending orders.
My code is giving me the list of only open positions.
Can you help me with modification so that it would get the symbols of both open and pending orders.
Thank you in Advance!