Symbol name for comparison

 

I am collecting the users input for the name of 3 symbols. They MUST match the name of the symbol as the broker displays them.

Later, I do a comparrison between the text provided by the user with the name of the Symbol, like the following:

      if (Symbol() == FirstPairValue)
      {
         OpenBuy();
      }
      else if (Symbol() == SecondPairValue)
      {
         OpenBuy();
      }
      else if (Symbol() == ThirdPairValue)
      {
         OpenBuy();
      }
As you can imagine, I had an uhoh moment when I realized that the Symbol() is actually a numeric value. DUH, so, any suggestion on how I can get a comparison? How can I determine that the Symbol the user is talking about is the same as
Symbol()?
 
LEHayes:
As you can imagine, I had an uhoh moment when I realized that the Symbol() is actually a numeric value. [...]

But Symbol() returns string...? You can compare strings, what's the problem?

 
gordon wrote >>

But Symbol() returns string...? You can compare strings, what's the problem?



I am the problem. Too much coding, not enough sleep. Turns out that I was using a string and a double to collect data, I meant to compare a string to symbol, instead I was comparing a double that held the value. It truly is a duh moment for me.

sorry to trouble you folks over this. I think I will get some sleep now.
 
According to MQ, the 'Symbol()' variable IS a string value.
There is also OrderSymbol() that returns the 'string' of open orders.
There is another one as well with another word tacked onto the beginning of *Symbol() but I can't recall it at the moment and searching in the MQL editor for 'Symbol' doesn't bring it up. But if I remember it correctly, it doesn't return a pure and litteral 'Character String' anyway.