How to find total number of symbols traded
at least from reading your post once, I have no idea what you mean, sorry. Please elaborate.
From the orderstotal, I only want to extract 4 pairs from the example above. It should only count the number of pairs only.
maybe this (or your mods make it 'this') - gives u launch point anyway...
edit.1: silly me! forgot check if trade or pending... hey! great mistake - maybe u can put in the 1 extra line or maybe 2 ;), in .... the function ;)
hint: OrderType()
good luck...
//+------------------------------------------------------------------+ //| ejoi.mq4 | //| ukt | //| https://forum.mql4.com/13216 | //+------------------------------------------------------------------+ #property copyright "publicDomain" #property link "https://forum.mql4.com/13216" //------------------------------------------------------------------------------ // program global declarations //- string saSymbols[] = {"GBPUSD","EURUSD","EURJPY","USDJPY"}; //can add or remove entries... //------------------------------------------------------------------------------ //- int start () { /****** COMMENT Life, the universe and all that - get's sorted out here ;) */ Print("iOrderTotal=",iGetOrderTotal(saSymbols)); return(0); }//start() //------------------------------------------------------------------------------ //- int iGetOrderTotal (string& saSymbols[]) { /*************** COMMENT Given list of symbol pairs, we look in trading pool for 'active/at market' order entries that have same symbol pair as one in given input list - this is a 'hit'. Count all 'hits' and return count to caller as function value */ int iOrderCount = OrdersTotal(); int iOrderTotal = 0; int iSyms2Test = ArraySize(saSymbols); string sSym; for(int iPos=0;iPos<iOrderCount;iPos++) { if(!OrderSelect(iPos,SELECT_BY_POS)) continue; //ok, here we have mapped trading pool entry of type: open/pending //- //let us see: IF entry has one of our symbol pairs THEN increment "total number of symbols traded" //- sSym = OrderSymbol(); for(int i=0;i<iSyms2Test;i++) //scan each sym list entry looking for match if(sSym==saSymbols[i]) iOrderTotal++; //found! so bump counter } return(iOrderTotal); }//iGetOrderTotal() /* quicky test results......... 2008.06.11 12:39:44 ejoi EURUSD,M15: removed 2008.06.11 12:39:44 ejoi EURUSD,M15: uninit reason 0 2008.06.11 12:39:44 ejoi EURUSD,M15: iOrderTotal=3 2008.06.11 12:39:44 ejoi EURUSD,M15: loaded successfully */
quicky test: trade orders tab on terminal
How to find total number of symbols traded.
eg. I am trading buy and sell GBPUSD, EURUSD, EURJPY and USDJPY
and I want this to return total of 4 pairs traded. Anyone know?