Expert Advisors: MT5 DDE - Server - page 4

 
mzee_zaki #:

I tried using your code but it only get me the Ask/Bid of the first currency pair in the list of symbols in MT5 regardless of the currency symbol I add in the code.

For example, I have USDCAD as the first symbol in MT5 symbols list. I write the code you provided with EURUSD, but the Ask price I get is the USDCAD one not the EURUSD one. How to fix that?

Also, do you have any suggestions on how to connect ask price of all currency pairs/symbols to Excel?

Thanks!

it`s working. I try now. 

=ЗАМЕНИТЬ(MT4DDE|ASK!EURAUD;2;1;",") - to excel cell with comma!

 
ISergeyevich # : =MT4DDE|BID!EURUSD - com ponto na célula do Excel =MT4DDE|ASK!EURUSD =ЗАМЕНИТЬ(MT4DDE|BID!EURUSD;2;1;",") =ЗАМЕНИТЬ(MT4DDE|ASK!EURUSD;2; 1;", ") =REPLACE(MT4DDE|BID!EURUSD;2;1;",") -  com vírgula na célula do Excel =REPLACE(MT4DDE|ASK!EURUSD;2;1;",")

When I use this command in my Excel, I have #REF!...

Auto-translation applied by moderator
 
@webvarzea #: When I use this command in my Excel, I have #REF!...
Auto-translation applied by moderator
On this the English forum, please post in English. Either use the automatic translation tool, or post in one of the other language forums.
 
Fernando Carreiro #: On this the English forum, please post in English. Either use the automatic translation tool, or post in one of the other language forums.

OH SORRY my man, its a mistake.

you know something about this problem to help me? im a like 6 hours trying to make working...

 

finaly i got it!!!!!

for the next people who come along and can't get it to work, my problem was solved, just opening everything in logical sequence.

first the dde server, then meta trader 5, put the robot in the pair I wanted, authorize all meta trader 5 dlls, and only then open excel.

my mistake was leaving excel open before opening all the other programs... here's the tip.

 
Can any one guide me to fetch net volume to Excel using DDE
I am able to fetch server name dae and time live I want net volume live to excel
 

Very useful and straight forward to use tool to retreive MT5 data to Excel. Here is some code to get it to retreive several data types from multiple assets simultaneously


void OnTimer()

{

  // Retrieve the current bid, ask, high, low, and last volume for the symbol of the chart

  double bidPrice = 0.0;

  double askPrice = 0.0;

  double highPrice = 0.0;

  double lowPrice = 0.0;

  double lastVolume = 0.0;

  string symbol = _Symbol; // Gets the symbol of the chart where the EA is attached

 

  if(SymbolInfoDouble(symbol, SYMBOL_BID, bidPrice) &&

     SymbolInfoDouble(symbol, SYMBOL_ASK, askPrice) &&

     SymbolInfoDouble(symbol, SYMBOL_HIGH, highPrice) &&

     SymbolInfoDouble(symbol, SYMBOL_LOW, lowPrice) &&

     SymbolInfoDouble(symbol, SYMBOL_VOLUME_REAL, lastVolume))

  {

    // Unique DDE topics for each symbol

    string bidTopic = symbol + "_BID";

    string askTopic = symbol + "_ASK";

    string highTopic = symbol + "_HIGH";

    string lowTopic = symbol + "_LOW";

    string volumeTopic = symbol + "_VOLUME";

 

    // Check & Add Items DDE for each data point with symbol name

    if(!CheckItem("PRICE", bidTopic)) AddItem("PRICE", bidTopic);

    if(!CheckItem("PRICE", askTopic)) AddItem("PRICE", askTopic);

    if(!CheckItem("PRICE", highTopic)) AddItem("PRICE", highTopic);

    if(!CheckItem("PRICE", lowTopic)) AddItem("PRICE", lowTopic);

    if(!CheckItem("PRICE", volumeTopic)) AddItem("PRICE", volumeTopic);

 

    // Set DDE items with the data

    SetItem("PRICE", bidTopic, DoubleToString(bidPrice, _Digits));

    SetItem("PRICE", askTopic, DoubleToString(askPrice, _Digits));

    SetItem("PRICE", highTopic, DoubleToString(highPrice, _Digits));

    SetItem("PRICE", lowTopic, DoubleToString(lowPrice, _Digits));

    SetItem("PRICE", volumeTopic, DoubleToString(lastVolume, 0)); // Volume is usually an integer

  }

  else

  {

    // Handle the error if any price information cannot be retrieved

    Alert("Error retrieving price information for " + symbol);

  }

}

 

//


rest of the existing code ...

 
example of running prices in 2035
example nPriceop=2001 for buy limit
trade.PositionOpen(_Symbol, ORDER_TYPE_BUY_LIMIT, 0.1, nOPPrice, 0, 0, "Commentyup"); I use the trade.mqh library on MT5..... and for buy and sell the execution runs normally.. but there are no open positions for buylimit and selllimit.... is there anyone here who can help me?