script sample code to loop trough all symbols to lookup for number of daily trades.

 

hello,

 

i would like a script sample code to loop trough all symbols to lookup for number of daily trades. 

 

thnks. 

 

Forum on trading, automated trading systems and testing trading strategies


Welcome,

  • Usually people who can't code don't receive free help on this forum, though it could happen if you are lucky, be patient.
  • If you show your attempts and describe well your problem, you will most probably receive an answer from the community.
  • If you don't want to learn to code, nothing bad, you can either look at the Codebase if something free already exists, or in the Market for paid products (sometimes free also).
  • Finally, you also have the option to hire a programmer in the Freelance section.

Good luck.


 
Alain Verleyen:

i can code... i just want the function that return me an array of all symbols or filtered by a search criteria.

 then i can loop trough it  to find wich one have a good number of trades.

i know metatrader has a lot of issues when loading symbols that are not loaded on the screen.

 
livetraderbr:

i can code... i just want the function that return me an array of all symbols or filtered by a search criteria.

 then i can loop trough it  to find wich one have a good number of trades.

i know metatrader has a lot of issues when loading symbols that are not loaded on the screen.

   string symbolNames[];
   bool   onlyInMarketWatch=true;
   int    size = SymbolsTotal(onlyInMarketWatch); ArrayResize(symbolNames,size);
         for (int i=0; i<size; i++)
            symbolNames[i] = SymbolName(i,onlyInMarketWatch);
Change the onlyInMarketWatch to false to get the symbols not shown in the market watch too
 
Mladen Rakic:
   string symbolNames[];
   bool   onlyInMarketWatch=true;
   int    size = SymbolsTotal(onlyInMarketWatch); ArrayResize(symbolNames,size);
         for (int i=0; i<size; i++)
            symbolNames[i] = SymbolName(i,onlyInMarketWatch);
Change the onlyInMarketWatch to false to get the symbols not shown in the market watch too

thanks for the answer !!!

 

the size array number is correct but the symbolname is always returning null. do you know why ? 

 
livetraderbr:

thanks for the answer !!!

 

the size array number is correct but the symbolname is always returning null. do you know why ? 

ive made a mistake !!!

 thank you very much for the help !!! 

 
ive got in trouble by sorting alphabetically the returning arra generated.

because i generated a string the the SYMBOL_PATH + SYMBOL_DESCRIPTION

the arraysort function seems to work only with numbers
Reason: