Download MetaTrader 5

Symbol()

To add comments, please log in or register
Do you keep a blog? Place a link to MQL5.community there and make money!
GrumpyDuckMan
40
GrumpyDuckMan 2017.03.18 12:41 

I have been reading over the reference manual "MQL4". I can't find the correct reference to a string for Symbol().

Alert("Currency=",(),Symbol());

At the moment the Alert reads the currency at the top of the watch window. How can I change this to reflect the watched currency that I wish to look at?

whroeder1
14480
whroeder1 2017.03.18 13:10  
"At all moments the Alert reads the currency" of the chart you are running the code on. Nothing to do with the Market Watch. Switch your chart to another.
GrumpyDuckMan
40
GrumpyDuckMan 2017.03.18 14:05  
whroeder1:
"At all moments the Alert reads the currency" of the chart you are running the code on. Nothing to do with the Market Watch. Switch your chart to another.

So charts are set up as an array? I believe they are. In that case the programmer needs to index the chart by naming it as a string, bool value FALSE/TRUE.

I admit that I am not a 100% programmer, but I am learning.

GrumpyDuckMan
40
GrumpyDuckMan 2017.03.18 14:08  

Sorry about not code tagging it. There you go.

 Alert("Currency=",Symbol());
   Print("Low=",MarketInfo(Symbol(),MODE_LOW));
   Print("High=",MarketInfo(Symbol(),MODE_HIGH));
   Print("Tick time=",(MarketInfo(Symbol(),MODE_TIME)));
   Print("Last bid price=",MarketInfo(Symbol(),MODE_BID));
   Print("Last ask price=",MarketInfo(Symbol(),MODE_ASK));
   Print("Points=",MarketInfo(Symbol(),MODE_POINT));
   Print("Digits decimal point=",MarketInfo(Symbol(),MODE_DIGITS));
   Print("Spread=",MarketInfo(Symbol(),MODE_SPREAD));
   Print("Stop level=",MarketInfo(Symbol(),MODE_STOPLEVEL));
   Print("Lot size in base currency=",MarketInfo(Symbol(),MODE_LOTSIZE));
   Print("Tick value in the deposit currency=",MarketInfo(Symbol(),MODE_TICKVALUE));
   Print("Tick size in points=",MarketInfo(Symbol(),MODE_TICKSIZE)); 
   Print("Swap buy order=",MarketInfo(Symbol(),MODE_SWAPLONG));
   Print("Swap sell order=",MarketInfo(Symbol(),MODE_SWAPSHORT));
   Print("Market starting date (for futures)=",MarketInfo(Symbol(),MODE_STARTING));
   Print("Market expiration date (for futures)=",MarketInfo(Symbol(),MODE_EXPIRATION));
   Alert("Trade is allowed for the symbol=",MarketInfo(Symbol(),MODE_TRADEALLOWED));
   Print("Minimum permitted amount of a lot=",MarketInfo(Symbol(),MODE_MINLOT));
   Print("Step for changing lots=",MarketInfo(Symbol(),MODE_LOTSTEP));
   Print("Maximum permitted amount of a lot=",MarketInfo(Symbol(),MODE_MAXLOT));
   Print("Swap calculation method=",MarketInfo(Symbol(),MODE_SWAPTYPE));
   Print("Profit calculation mode=",MarketInfo(Symbol(),MODE_PROFITCALCMODE));
   Print("Margin calculation mode=",MarketInfo(Symbol(),MODE_MARGINCALCMODE));
   Print("Initial margin requirements for 1 lot=",MarketInfo(Symbol(),MODE_MARGININIT));
   Print("Margin to maintain open orders calculated for 1 lot=",MarketInfo(Symbol(),MODE_MARGINMAINTENANCE));
   Print("Hedged margin calculated for 1 lot=",MarketInfo(Symbol(),MODE_MARGINHEDGED));
   Print("Free margin required to open 1 lot for buying=",MarketInfo(Symbol(),MODE_MARGINREQUIRED));
   Print("Order freeze level in points=",MarketInfo(Symbol(),MODE_FREEZELEVEL)); 
  }

To add comments, please log in or register