Handle a list of markets

 

Hi,

I wanna handle a list of markets using their symbol and execute my code then if some conditions reached, return the name of the symbol. I want to run it on a vps if its possible.

Can someone tell me a coding library reference to do this? and I would be appreciated if you can send me some coding samples related to my needs because this is my fist program.

Thanks 

 
saeeds255:

Hi,

I wanna handle a list of markets using their symbol and execute my code then if some conditions reached, return the name of the symbol. I want to run it on a vps if its possible.

Can someone tell me a coding library reference to do this? and I would be appreciated if you can send me some coding samples related to my needs because this is my fist program.

Thanks 

Maybe we should start with this: Market Info.
 
Karputov Vladimir:
Maybe we should start with this: Market Info.

Thanks. they should help

Can someone give me some examples of how to use them? I mean a basic template how to start with them and putting them together. 

 
saeeds255:

Thanks. they should help

Can someone give me some examples of how to use them? I mean a basic template how to start with them and putting them together. 

Find Symbol, and Buy.

//+------------------------------------------------------------------+
//|                                     SymbolsTotal SymbolsName.mq5 |
//|                              Copyright © 2016, Vladimir Karputov |
//|                                           http://wmua.ru/slesar/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2016, Vladimir Karputov"
#property link      "http://wmua.ru/slesar/"
#property version   "1.00"
#include<Trade\Trade.mqh>
#property script_show_inputs
//--- input parameters
input string   find_symbol="EURUSD";
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   if(FindSymbol(find_symbol))
     {
      //--- choosing the direction of the transaction
      //
      //--- transaction volume calculation
      //
      CTrade my_trade;
      my_trade.Buy(0.01,find_symbol);
     }
  }
//+------------------------------------------------------------------+
//| Find Symbol                                                      |
//+------------------------------------------------------------------+
bool FindSymbol(const string &name)
  {
   if(!SymbolInfoInteger(name,SYMBOL_SELECT))
     {
      if(GetLastError()==ERR_MARKET_UNKNOWN_SYMBOL)
        {
         Print("Unknown symbol ",name);
         return(false);
        }
      if(!SymbolSelect(name,true))
        {
         Print("Error select ",name);
         return(false);
        }
      Sleep(3000);
     }
//---
   return(true);
  }
//+------------------------------------------------------------------+
 

Or here's another:

//+------------------------------------------------------------------+
//|                                                 SymbolsTotal.mq5 |
//|                        Copyright 2016, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   int  symbols_total=SymbolsTotal(true);
   for(int i=0;i<symbols_total;i++)
      Print("Numder ",IntegerToString(i),": ",SymbolName(i,true));
  }
//+------------------------------------------------------------------+

Window MarketWatch:

MarketWatch

and tab 'Experts":

2016.08.08 16:26:27.438 SymbolsTotal (EURUSD,M5)        Numder 0: EURUSD
2016.08.08 16:26:27.438 SymbolsTotal (EURUSD,M5)        Numder 1: GBPUSD
2016.08.08 16:26:27.438 SymbolsTotal (EURUSD,M5)        Numder 2: USDJPY
2016.08.08 16:26:27.438 SymbolsTotal (EURUSD,M5)        Numder 3: AUDNZD
2016.08.08 16:26:27.438 SymbolsTotal (EURUSD,M5)        Numder 4: AUDCHF
Files:
 
Karputov Vladimir:

Find Symbol, and Buy.

Thanks !

 These files helped me a lot. I will try to complete my script using them.