Expert Advisors: MT5 DDE - Server - page 8

 

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?
 

I have reprogrammed it so that I receive live tick (bid and ask) data directly in excel/libreoffice. Exactly the same as with MT4. No difference at all. Thanks for that!

 
Hi, will his work with google sheets instead of excel?
 
@adamko40 #: Hi, will his work with google sheets instead of excel?
Google Sheets is a web application. It does not use DDE.