_Symbol or Symbol() ... any way to get in a string the symbol name?

 

Hi

I want to get the symbol name , can I do it with _Symbol or Symbol()? if not, any other way?

 
Javier Santiago Gaston De Iriarte Cabrera:

Hi

I want to get the symbol name , can I do it with _Symbol or Symbol()? if not, any other way?

Yes you can.
 
Javier Santiago Gaston De Iriarte Cabrera:

Hi

I want to get the symbol name , can I do it with _Symbol or Symbol()? if not, any other way?

Yes, both of them returns the symbol name. 

// Expert Initializing --------------------
int OnInit()
  {
   return(INIT_SUCCEEDED);
  }

// Expert DeInitializing -------------------
void OnDeinit(const int reason)
  {

  }

// Expert OnTick --------------------------
void OnTick()
  {
   Comment("\n","Symbol Name by _Symbol -:" , _Symbol,
           "\n", "Symbol Name by Symbol(); -: ", Symbol());
  } // OnTick End  <<----------------------
 
Javier Santiago Gaston De Iriarte CabreraHi I want to get the symbol name , can I do it with _Symbol or Symbol()? if not, any other way?

Hi, I'm not sure I understand, but if you're referring to symbols with a prefix and/or suffix, here's an example:

//--- Get SYMBOL
   string SYMBOL = _Symbol;
   if(!StringToUpper(SYMBOL))
     {
      Print("Error getting current symbol name: ", GetLastError());
      return(INIT_FAILED);
     }

//--- Checks SETTINGS
   if(StringFind(SYMBOL, "EURUSD") >= 0)
     {
      Setting_EURUSD();
     }
 
Vinicius Pereira De Oliveira #:

Hi, I'm not sure I understand, but if you're referring to symbols with a prefix and/or suffix, here's an example:

Thanks, and thanks to all... yes, I didn't said why I needed it, but its that.