MetaTrader 4 Platform Update Build 670: Virtual Hosting, Web Requests and Working with Signals from MQL Applications - page 6

 
I have a script that use dll. This library use another dll written in C# (ex4 import first dll and first dll import second dll). I copy this two dlls into AppData\Roaming\...\MQ4\Libraries directory and it's works great. Sometimes, in prev versions of mt4, i must copy it to Program Files\MT4\MQL4\Libraries directory, but in build 670 it doesn't work. I'm getting FileNotFound Exception when I ivoke a class from a C# dll. Where I should put dll files?
 
invest01:
I have a script that use dll. This library use another dll written in C# (ex4 import first dll and first dll import second dll). I copy this two dlls into AppData\Roaming\...\MQ4\Libraries directory and it's works great. Sometimes, in prev versions of mt4, i must copy it to Program Files\MT4\MQL4\Libraries directory, but in build 670 it doesn't work. I'm getting FileNotFound Exception when I ivoke a class from a C# dll. Where I should put dll files?
Please read the documentation : https://docs.mql4.com/runtime/imports
 
angevoyageur:
Please read the documentation : https://docs.mql4.com/runtime/imports


Thanks angevoyageur for reply. I have read documentation carefully and I put libraries to all possible directories. The same effect. May be I'm doing something incorrectly or I don't understand it. I think that it should works identically in build 670 and in prev versions. In attachment is mq4 file and 2 dlls to test. This test ea display window with button. If button is clicked, than it call function from other dll. In mt4 build 646 it show message box, but in 670 it throws exception: file not found. One of dlls is written in c++ so require visual c++ redistributable packages 2013 x86 (http://www.microsoft.com/en-us/download/details.aspx?id=40784). Can someone try to run it on version 670?
Files:
testdll.zip  24 kb
 
invest01:

Thanks angevoyageur for reply. I have read documentation carefully and I put libraries to all possible directories. The same effect. May be I'm doing something incorrectly or I don't understand it. I think that it should works identically in build 670 and in prev versions. In attachment is mq4 file and 2 dlls to test. This test ea display window with button. If button is clicked, than it call function from other dll. In mt4 build 646 it show message box, but in 670 it throws exception: file not found. One of dlls is written in c++ so require visual c++ redistributable packages 2013 x86 (http://www.microsoft.com/en-us/download/details.aspx?id=40784). Can someone try to run it on version 670?

I have found a solution. New version MT4 load dependency library from directory where is terminal.exe (e.g. C:\Program Files (x86)\MetaTrader 4). To successfully load this library, MT4 must be run with administrator privileges.
 

Seems like there is a bug in function iMAOnArray when it is used in MT4 Strategy Tester. The calculation of EMA and SMMA is wrong. The EMA and SMMA line will be a nearly straight line with very small changes compared to the SMA and LWMA lines, which follow the price as they should.

Here is a test indicator to reproduce the problem. Run it in Strategy Tester and check the Brown (EMA) and Gold (SMMA) color lines. Red line is the price, Blue is SMA and Green is LWMA.


#property copyright "Copyright 2014, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
#property indicator_separate_window

#property indicator_buffers 5
#property indicator_color1 Red
#property indicator_width1 1
#property indicator_color2 DodgerBlue
#property indicator_width2 1
#property indicator_color3 Brown
#property indicator_width3 1
#property indicator_color4 Gold
#property indicator_width4 1
#property indicator_color5 Lime
#property indicator_width5 1

input int MAperiod = 20;                // MA period

double ClosePriceArray [];
double MAArray1 [];
double MAArray2 [];
double MAArray3 [];
double MAArray4 [];

double Buffer1 [];
double Buffer2 [];
double Buffer3 [];
double Buffer4 [];
double Buffer5 [];


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
{
   SetIndexBuffer(0, Buffer1);
   SetIndexStyle(0, DRAW_LINE, 0, 1);
   SetIndexBuffer(1, Buffer2);
   SetIndexStyle(1, DRAW_LINE, 0, 1);
   SetIndexBuffer(2, Buffer3);
   SetIndexStyle(2, DRAW_LINE, 0, 1);
   SetIndexBuffer(3, Buffer4);
   SetIndexStyle(3, DRAW_LINE, 0, 1);
   SetIndexBuffer(4, Buffer5);
   SetIndexStyle(4, DRAW_LINE, 0, 1);

   IndicatorShortName("MA-test");
   ArrayResize(ClosePriceArray,800);
   ArraySetAsSeries(ClosePriceArray,True);
   ArrayResize(MAArray1,800);
   ArrayResize(MAArray2,800);
   ArrayResize(MAArray3,800);
   ArrayResize(MAArray4,800);

   int i;
   for(i=0; i<800; i++) ClosePriceArray[i]=Close[i];
   for(i=0; i<800; i++) MAArray1[i]=Close[i];
   for(i=0; i<800; i++) MAArray2[i]=Close[i];
   for(i=0; i<800; i++) MAArray3[i]=Close[i];
   for(i=0; i<800; i++) MAArray4[i]=Close[i];

   return(INIT_SUCCEEDED);
}


//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,const int prev_calculated,const datetime &time[],const double &open[],const double &high[],const double &low[],const double &close[],const long &tick_volume[],const long &volume[],const int &spread[])
{
   int i, limit;

   for(i=799; i>0; i--) ClosePriceArray[i]=ClosePriceArray[i-1];
   ClosePriceArray[0]=Close[0];


   for(i=799; i>0; i--) MAArray1[i]=MAArray1[i-1];
   MAArray1[0]=iMAOnArray(ClosePriceArray,0,MAperiod,0,MODE_SMA,0);

   for(i=799; i>0; i--) MAArray2[i]=MAArray2[i-1];
   MAArray2[0]=iMAOnArray(ClosePriceArray,0,MAperiod,0,MODE_EMA,0);

   for(i=799; i>0; i--) MAArray3[i]=MAArray3[i-1];
   MAArray3[0]=iMAOnArray(ClosePriceArray,0,MAperiod,0,MODE_SMMA,0);

   for(i=799; i>0; i--) MAArray4[i]=MAArray4[i-1];
   MAArray4[0]=iMAOnArray(ClosePriceArray,0,MAperiod,0,MODE_LWMA,0);


   if (Bars > 800) limit=800;  else limit=Bars;


   for(i=0; i<limit; i++)
     {
        Buffer1[i]=ClosePriceArray[i];
        Buffer2[i]=MAArray1[i];
        Buffer3[i]=MAArray2[i];
        Buffer4[i]=MAArray3[i];
        Buffer5[i]=MAArray4[i];
     }

   return(rates_total);
}
 

hi, why can i download the terminal when i click the download button, this is the page that shown 

 

Try this ..

https://download.mql5.com/cdn/web/metaquotes.software.corp/mt4/mt4setup.exe

Reason: