MetaTrader 4 Build 529 beta released with new compiler - page 105

 
Night63:

Colleagues, I get a warning on compilation:

possible use of uninitialized variable 'PipStep'

for a chunk like this:

All variables are initialised as double, what's wrong with it?

you declared variables of type double, initialization is assigning values to the declared variables

double PipStep=0 ; make

 
I don't understand, am I the only one who can't test the indicator demos in the 555 build, or is this not an important issue for the Market debut at all?
 
Candid:
I don't understand, am I the only one who can't test the indicator demos in the 555 build, or is this not an important issue for the Market debut at all?

are they tested in 5?
 

ArrayCopyRates() также изменила свое поведение, раньше она производила виртуальное копирование в массив double[][6], теперь же производится виртуальное копирование в массив MqlRates[]. Для совместимости осталось копирование в массив double[][6], но это копирование не виртуальное, а реальное.

https://www.mql5.com/ru/forum/148325

MqlRates

Structure for storing price, volume and spread information.

https://www.mql5.com/ru/docs/constants/structures/mqlrates

Is MqlRates in MetaTrader 4 build 555 an array or a structure?

This example from help (MetaTrader 4 build 555) does not work as there is no function CopyRates

void OnStart()
  {
//---
   MqlRates rates[];
   ArraySetAsSeries(rates,true);
   int copied=CopyRates(Symbol(),0,0,100,rates);
   if(copied>0)
     {
      Print("Скопировано баров: "+copied);
      string format="open = %G, high = %G, low = %G, close = %G, volume = %d";
      string out;
      int size=fmin(copied,10);
      for(int i=0;i<size;i++)
        {
         out=i+":"+TimeToString(rates[i].time);
         out=out+" "+StringFormat(format,
                                  rates[i].open,
                                  rates[i].high,
                                  rates[i].low,
                                  rates[i].close,
                                  rates[i].tick_volume);
         Print(out);
        }
     }
   else Print("Не удалось получить исторические данные по символу ",Symbol());
  }
 

//+------------------------------------------------------------------+
//|                                                     my_test1.mq4 |
//|                        Copyright 2013, MetaQuotes Software Corp. |
//|                                              https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property  strict
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
   MqlRates rates[];
   ArraySetAsSeries(rates,true);
   ArrayCopyRates(rates,"EURUSD",PERIOD_M1);
   //int copied=CopyRates(Symbol(),0,0,100,rates);

   Print(
         " спред ",rates[6].spread               
         );
  }
//+------------------------------------------------------------------+
This doesn't work either, can you see a working example in MetaTrader 4 build 555 with MqlRates ?
 
ALXIMIKS:

Do they test in 5?

Do some people not test in 5 either?
 
ALXIMIKS:

you declare variables of type double, initialisation is the assignment of values to the declared variables

double PipStep=0 ; do


It worked!!!

Live and learn!

Thank you very much!

 
serferrer:

Is MqlRates in MetaTrader 4 build 555 an array or a structure?

This example from help (MetaTrader 4 build 555) does not work as there is no function CopyRates

This does not work either, can we see a working example in MetaTrader 4 build 555 with MqlRates ?


MqlRates - structure

MqlRates[] - array of structures

To see an example of working with MqlRates structure see script period_converter_new

An example of ArrayCopyRates operation (documentation will be updated)

MqlRates array1[];
ArrayCopyRates(array1,"EURUSD", PERIOD_H1);
Print("Текущий бар ",array1[0].time,"  цена открытия ", array1[0].open);
 
MetaQuotes:

Changes in MQL4

  • ArrayCopyRates() has also changed its behaviour. It used to virtually copy to array double[][6], now it virtually copies to array MqlRates[]. Now copying to array double[][6] is performed, but it's not virtual; it's real.

I have a significant number of Expert Advisors that use DLLs and they have been passed to customers a long time ago. We used arrays double[][6] to pass parameters to the DLL , which were virtually copied into by ArrayCopyRates() during initialization .And then when calling functions from DLL these arrays and their current size were passed by reference as their parameters.

It turns out that all these EAs will stop working when the terminal is updated to a new version. This is unfortunate.

Do I correctly understand that to keep them working without changing the DLL code, we should call ArrayCopyRates() before each call of a function from the DLL?

 
stringo:
There is now no spread value (possibly also exchange volume ) in the MqlRates structure, will this be added later?
 
Patrol:

I have a significant number of EAs using DLLs, which have been handed over to customers a long time ago. To pass parameters to DLL we used arrays double[][6], to which during initialization ArrayCopyRates() function made virtual copying of timeseries. And then when calling functions from DLL these arrays and their current size were passed by reference as their parameters.

It turns out that all these EAs will stop working when the terminal is updated to a new version. This is unfortunate.

Do I correctly understand that in order to keep them working without changing the DLL code, we should call ArrayCopyRates() before each call of a function from the DLL?


It's a little more complicated than that. The structure that the dll takes has also changed.

So, you need to rewrite ArrayCopyRates into MqlRates structure array. Also in your dll you need to replace the description of corresponding structure