SymbolSelect

Piyasa Gözlemi penceresindeki bir sembolü seçer veya bir sembolü pencereden siler.

bool  SymbolSelect(
   string  name,       // sembol ismi
   bool    select      // ekle veya kaldır
   );

Parametreler

name

[in] Sembol ismi.

select

[in] Seçim. 'false' değeri seçilirse, Piyasa Gözlemi penceresinden bir sembol silinmelidir; aksi durumda ise, bu pencereden bir sembol seçilmelidir. Sembolün çizelge penceresi açıksa veya bu sembolde açık pozisyonlar varsa, sembol kaldırılamaz.

Dönüş değeri

Başarısızlık durumunda 'false' dönüşü yapar.

Örnek:

#define SYMBOL_NAME "GBPHKD"
 
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//--- listelerde sembolün olup olmadığını kontrol et, bulunamazsa raporla ve çalışmayı tamamla
   bool custom = false;
   if(!SymbolExist(SYMBOL_NAMEcustom))
     {
      PrintFormat("'%s' symbol not found in the lists"SYMBOL_NAME);
      return;
     }
     
//--- Piyasa Gözlemi penceresine sembol ekle
   ResetLastError();
   if(!SymbolSelect(SYMBOL_NAMEtrue))
     {
      Print("SymbolSelect() failed. Error "GetLastError());
      return;
     }
//--- sembol listeye başarıyla eklenirse, Piyasa Gözlemi penceresinden indeksini al ve sonucu günlüğe gönder
   int index = SymbolIndex(SYMBOL_NAME);
   PrintFormat("The '%s' symbol has been added to the MarketWatch list. Symbol index in the list: %d"SYMBOL_NAMEindex);
     
//--- şimdi sembolü Piyasa Gözlemi penceresinden kaldır
   ResetLastError();
   if(!SymbolSelect(SYMBOL_NAMEfalse))
     {
      Print("SymbolSelect() failed. Error "GetLastError());
      return;
     }
//--- sembol listeden başarıyla çıkarılırsa, Piyasa Gözlemi penceresindeki indeksi -1 olur, silme sonucunu günlüğe gönder
   index = SymbolIndex(SYMBOL_NAME);
   PrintFormat("The '%s' symbol has been removed from the MarketWatch list. Symbol index in the list: %d"SYMBOL_NAMEindex);
   
   /*
  sonuç:
   The 'GBPHKDsymbol has been added to the MarketWatch listSymbol index in the list12
   The 'GBPHKDsymbol has been removed from the MarketWatch listSymbol index in the list: -1
   */
  }
//+------------------------------------------------------------------+
//| Piyasa Gözlemi sembol listesindeki sembol indeksini geri döndür  |
//+------------------------------------------------------------------+
int SymbolIndex(const string symbol)
  {
   int total = SymbolsTotal(true);
   for(int i=0i<totali++)
     {
      string name = SymbolName(itrue);
      if(name == symbol)
         return i;
     }
   return(WRONG_VALUE);
  }