Expert Advisors: MT5 DDE - Server - page 6

 
Cen Chen:
Hi brother, do you have a MT4 version of this. the MT4 DDE doesn't work. But the one I'm using for FX doesn't have an MT5 server. Thanks for providing me a code if you have one. I want to get my net worth and position currency profit/loss,.
https://www.metatrader4.com/zh/trading-platform/help/service/dde
Export of Quotes - Tools - MetaTrader 4帮助
Export of Quotes - Tools - MetaTrader 4帮助
  • www.metatrader4.com
Source data serving as a basis for the entire analytical work of the terminal user are those about security price changes. This information is...
 

The method upstairs can't get the net value and currency gain/loss, only the high open/low close price.

Here is a method through the RTD bridge method, interested in reading http://www.fxchs.com/productdetails.aspx?pcid=2&pid=63

 

THOMASILVA :


Please visit the brazilian comments 


https://www.mql5.com/en/forum/33344

Forum on trading, automated trading systems and testing trading strategies

Expert Advisors: MT5 DDE - Server

Tom Sasson , 2020.06.28 09:52

Sorry for late replying, it was possible of course.

I said "was" because I haven't used this tool for 3 years now, and haven't tried on Windows 10 so you may experiment and report back.

@Tom Sasson


Hi THOMASILVA,

Following these steps ...


Start the DDE server.

Start mt5 and compile dde_example.mq5.

Open the graph of the desired asset in mt5 and drag the dde_example.ex5 (result of the compilation).

You will see the items on the server display.


... I still not able to show up any values ​​into the MT4DDE window even though the sample EA is running.

May you have any advice about MT5 or Windows config or other aspects that could affect the process?

(ie for MT4 DDE it's required to allow DDE server but this checkbox is not in MT5)

Thanks in advance!

Porque a Hospedagem Virtual no MetaTrader 4 e no MetaTrader 5 são Melhores que os VPS Usuais
Porque a Hospedagem Virtual no MetaTrader 4 e no MetaTrader 5 são Melhores que os VPS Usuais
  • www.mql5.com
A rede de hospedagem virtual em nuvem foi desenvolvida especialmente para o MetaTrader 4 e o MetaTrader 5, possuindo todas as vantagens de uma solução nativa. Obtenha os benefícios de nossa oferta gratuita por 24 horas - teste um servidor virtual agora mesmo.
 

I changed the code a little to print the most basic values: Current, Open, Close, Low of the Day and High of the Day.


void OnInit()
  {
    EventSetTimer(1);

   return;
  }

void OnTimer()

  {
//--- filling an array MA[] with current values of iMA
//--- Copying 100 elements


// Check & Add Item DDE
   if(!CheckItem(_Symbol,"Atual")) 
     {
      if(!AddItem(_Symbol,"Atual")) return; 
     } 
     
   if(!CheckItem(_Symbol,"Abertura")) AddItem(_Symbol,"Abertura");
   if(!CheckItem(_Symbol,"Fechamento")) AddItem(_Symbol,"Fechamento");
   if(!CheckItem(_Symbol,"Minimum")) AddItem(_Symbol,"Minimum");
   if(!CheckItem(_Symbol,"Maximum")) AddItem(_Symbol,"Maximum");


// Set Item Value DDE 
   //HCL candles
   SetItem(_Symbol,"Atual",SymbolInfoDouble(_Symbol,SYMBOL_LAST));
   SetItem(_Symbol,"Abertura",SymbolInfoDouble(_Symbol,SYMBOL_SESSION_OPEN));
   SetItem(_Symbol,"Fechamento",SymbolInfoDouble(_Symbol,SYMBOL_SESSION_CLOSE));
   SetItem(_Symbol,"Minimum",SymbolInfoDouble(_Symbol,SYMBOL_LASTLOW));
   SetItem(_Symbol,"Maximum",SymbolInfoDouble(_Symbol,SYMBOL_LASTHIGH));
  }
 

It lacks polish but is functional if you need the DDE to report the values in international format (separating thousands with a full stop and decimals with a comma).

Example: Quotation of 12 reais and 13 centavos, instead of reporting 12.13, with the script below it will report 12.13. Great for keeping the Excel spreadsheet the way it's already installed.


void OnInit()
  {
    EventSetTimer(1);

   return;
  }

void OnTimer()

  {
//--- filling an array MA[] with current values of iMA
//--- Copying 100 elements


// Check & Add Item DDE
   if(!CheckItem(_Symbol,"Atual")) 
     {
      if(!AddItem(_Symbol,"Atual")) return; 
     } 
     
   if(!CheckItem(_Symbol,"Abertura")) AddItem(_Symbol,"Abertura");
   if(!CheckItem(_Symbol,"Fechamento")) AddItem(_Symbol,"Fechamento");
   if(!CheckItem(_Symbol,"Minimum")) AddItem(_Symbol,"Minimum");
   if(!CheckItem(_Symbol,"Maximum")) AddItem(_Symbol,"Maximum");


// Set Item Value DDE 
   //HCL candles
   string atual = SymbolInfoDouble(_Symbol,SYMBOL_LAST);
   string abertura = SymbolInfoDouble(_Symbol,SYMBOL_SESSION_OPEN);
   string fechamento = SymbolInfoDouble(_Symbol,SYMBOL_SESSION_CLOSE);
   string minima = SymbolInfoDouble(_Symbol,SYMBOL_LASTLOW);
   string maxima = SymbolInfoDouble(_Symbol,SYMBOL_LASTHIGH);
   
   StringReplace(atual,".",",");
   StringReplace(abertura,".",",");
   StringReplace(fechamento,".",",");
   StringReplace(minima,".",",");
   StringReplace(maxima,".",",");
   
   SetItem(_Symbol,"Atual",atual);
   SetItem(_Symbol,"Abertura",abertura);
   SetItem(_Symbol,"Fechamento",fechamento);
   SetItem(_Symbol,"Minimum",minima);
   SetItem(_Symbol,"Maximum",maxima);
  }
 

I can't place ticks that have a dash, for example (OIL-XXX) OR BRENT-XXX Can anyone tell me how to change the ask and bid codes to pick up these ticks?

 
Hello colleagues. The application is quite interesting, especially for beginners. I use it extensively, to develop and test my strategies, together with Excell capabilities. I have one important question. Maybe someone who is more experienced and knows how to do the reverse action: read some common data from DDE into an MQL programme? I would be grateful for some simple example, which I would like to study and further use widely in my developments.
 
can I get bid-ask quotes?
 
Luis Henrique Cavallari #:

Here are the changes I've made to the code below.

Can I use this code to export the price variation field via DDE from Meta Trader 5 to Excel in real time?
 
Hi,how can I transfer data from MT4 to excel?