MetaTrader 5 Python User Group - how to use Python in Metatrader - page 26

 
Lyuk:

GPU seems to be required after all

On an older Sandy Bridge, it works without a graphics card.

 

Can I see the results of the test ?

 
Lyuk:

Can I see the results of the test ?

Single thread: the value of PI is 3.141592653590
Single thread: calculated in 8.885725000000001 seconds
OpenCL: CPU device ' Intel(R) Core(TM) i7-2700K CPU @ 3.50GHz' selected
OpenCL threads: the value of PI is 3.141592653590
OpenCL threads: calculated in 0.8930439999999999 seconds
 
You need something like this on OpenCL
int SetArray( int &Array[] )
{
  const int Size = ArrayResize(Array, 1 e6);
  
  for (int i =  0; i < Size; i++)
    Array[i] = 1 - ((i & 1) << 1); // Чередование +-1
    
  return(Size);
}

void OnStart()
{
  int Array[];  
  const int Size = SetArray(Array); // Задали исходные данные

  int Sum = 0;
  
  for (int i = 0; i < 1 e3; i++)
    for (int j = 0; j < Size; j++)      
        Sum += Array[j];
        
  Print(Sum);      
}
 

Support for Python in both the MetaEditor and the interprocess API will be extended:


 
Vladimir Karputov:

Dmitry Prokopyev:

pip install --upgrade MetaTrader5

Requirement already up-to-date: MetaTrader5 in c:\works\mt_websocket_server\.env\lib\site-packages (5.0.8)



Gentlemen, any understanding on the issue of confused high/low?

 
Maxim Dmitrievsky:

https://www.mql5.com/ru/docs/integration/python_metatrader5/mt5copyratesrange_py

The example uses a different function, a mistake:

# obtain bars with USDJPY M5 from 01.04.2019 in UTC timezone
rates=MT5CopyRatesFrom("USDJPY",MT5_TIMEFRAME_M5,utc_from, utc_to)

expected: MT5CopyRatesRange()

Thank you, corrected.

 
Vladimir Karputov:

I would like to draw attention to:

MT5Rate(time=datetime.datetime(2018,4, 3, 16, 0), open=1.22957, low=1.22989, high=1.22557, close=1.2258, tick_volume=11956, spread=1, real_volume=0)

go to the terminal, see low/hight for this frame:

We see thatlow=1.22557,high=1.22989

Question is this a bug or are keys for the MT5Rate somehow configurable?

Thanks for the message, the developers have been informed. Will fix the header
 
Rashid Umarov:
Thanks for the message, the developers have been informed. They'll fix the title.

Thank you.

Drop me a line in this thread when the new release comes out.

 

Version 5.0.9 is available:

python -m pip install --upgrade MetaTrader5