MetaTrader 5 Python User Group - the summary - page 33

 
Alexandr Nikolaev #:

Hello, I found a bug: copy_rates_range returns the wrong data - it should return OHLC bar data, but it returns tick data. I didn't know where to report it.

I used a sample code from the reference book with other dates and instrument:

and the output is:

MetaTrader5 package author:  MetaQuotes Ltd.

MetaTrader5 package version:  5.0.4682

Выведем полученные данные как есть

(1704844800, 1.09291, 1.09291, 1.09262, 4607600487953426211, 6, 18, 0.)

(1704845100, 1.09284, 1.09285, 1.09237, 4607599271981526821, 19, 7, 0.)

(1704845400, 1.09263, 1.09284, 1.09263, 4607599587233500737, 15, 16, 0.)

(1704845700, 1.09257, 1.09288, 1.09257, 4607600487953426211, 8, 13, 0.)

(1704846000, 1.09283, 1.09287, 1.09283, 4607600532989422485, 64, 15, 0.)

(1704846300, 1.09285, 1.09286, 1.09265, 4607599992557467200, 17, 15, 0.)

(1704846600, 1.09273, 1.09286, 1.ТЬа09273, 4607600623061415032, 23, 19, 0.)

(1704846900, 1.09286, 1.09288, 1.09283, 4607600713133407580, 11, 17, 0.)

(1704847200, 1.09288, 1.09288, 1.09282, 4607600713133407580, 9, 13, 0.)

(1704847500, 1.09288, 1.09289, 1.09286, 4607600758169403853, 12, 11, 0.)


Выведем датафрейм с данными

                 time      bid      ask     last               volume  time_msc  flags  volume_real

0 2024-01-10 00:00:00  1.09291  1.09291  1.09262  4607600487953426211         6     18          0.0

1 2024-01-10 00:05:00  1.09284  1.09285  1.09237  4607599271981526821        19      7          0.0

2 2024-01-10 00:10:00  1.09263  1.09284  1.09263  4607599587233500737        15     16          0.0

3 2024-01-10 00:15:00  1.09257  1.09288  1.09257  4607600487953426211         8     13          0.0

4 2024-01-10 00:20:00  1.09283  1.09287  1.09283  4607600532989422485        64     15          0.0

5 2024-01-10 00:25:00  1.09285  1.09286  1.09265  4607599992557467200        17     15          0.0

6 2024-01-10 00:30:00  1.09273  1.09286  1.09273  4607600623061415032        23     19          0.0

7 2024-01-10 00:35:00  1.09286  1.09288  1.09283  4607600713133407580        11     17          0.0

8 2024-01-10 00:40:00  1.09288  1.09288  1.09282  4607600713133407580         9     13          0.0

9 2024-01-10 00:45:00  1.09288  1.09289  1.09286  4607600758169403853        12     11          0.0

A was supposed to get a type of data like this:

MetaTrader5 package author:  MetaQuotes Software Corp. 

MetaTrader5 package version:  5.0.29 

Выведем полученные данные как есть 

(1578614400, 109.513, 109.527, 109.505, 109.521, 43, 2, 0) 

(1578614700, 109.521, 109.549, 109.518, 109.543, 215, 8, 0) 

(1578615000, 109.543, 109.543, 109.466, 109.505, 98, 10, 0) 

(1578615300, 109.504, 109.534, 109.502, 109.517, 155, 8, 0) 

(1578615600, 109.517, 109.539, 109.513, 109.527, 71, 4, 0) 

(1578615900, 109.526, 109.537, 109.484, 109.52, 106, 9, 0) 

(1578616200, 109.52, 109.524, 109.508, 109.51, 205, 7, 0) 

(1578616500, 109.51, 109.51, 109.491, 109.496, 44, 8, 0) 

(1578616800, 109.496, 109.509, 109.487, 109.5, 85, 5, 0) 

(1578617100, 109.5, 109.504, 109.487, 109.489, 82, 7, 0) 

  

Выведем датафрейм с данными 

                 time     open     high      low    close  tick_volume  spread  real_volume 

0 2020-01-10 00:00:00  109.513  109.527  109.505  109.521           43       2            0 

1 2020-01-10 00:05:00  109.521  109.549  109.518  109.543          215       8            0 

2 2020-01-10 00:10:00  109.543  109.543  109.466  109.505           98      10            0 

3 2020-01-10 00:15:00  109.504  109.534  109.502  109.517          155       8            0 

4 2020-01-10 00:20:00  109.517  109.539  109.513  109.527           71       4            0 

5 2020-01-10 00:25:00  109.526  109.537  109.484  109.520          106       9            0 

6 2020-01-10 00:30:00  109.520  109.524  109.508  109.510          205       7            0 

7 2020-01-10 00:35:00  109.510  109.510  109.491  109.496           44       8            0 

8 2020-01-10 00:40:00  109.496  109.509  109.487  109.500           85       5            0 

9 2020-01-10 00:45:00  109.500  109.504  109.487  109.489           82       7            0

I downgraded the MetaTrader5 library to version 5.0.4200 and it worked fine:

MetaTrader5 package author:  MetaQuotes Ltd.

MetaTrader5 package version:  5.0.4200

Выведем полученные данные как есть

(1704844800, 1.09291, 1.09291, 1.09262, 1.09283, 6, 18, 0)

(1704845100, 1.09284, 1.09285, 1.09237, 1.09256, 19, 7, 0)

(1704845400, 1.09263, 1.09284, 1.09263, 1.09263, 15, 16, 0)

(1704845700, 1.09257, 1.09288, 1.09257, 1.09283, 8, 13, 0)

(1704846000, 1.09283, 1.09287, 1.09283, 1.09284, 64, 15, 0)

(1704846300, 1.09285, 1.09286, 1.09265, 1.09272, 17, 15, 0)

(1704846600, 1.09273, 1.09286, 1.09273, 1.09286, 23, 19, 0)

(1704846900, 1.09286, 1.09288, 1.09283, 1.09288, 11, 17, 0)

(1704847200, 1.09288, 1.09288, 1.09282, 1.09288, 9, 13, 0)

(1704847500, 1.09288, 1.09289, 1.09286, 1.09289, 12, 11, 0)


Выведем датафрейм с данными

                 time     open     high      low    close  tick_volume  spread  real_volume

0 2024-01-10 00:00:00  1.09291  1.09291  1.09262  1.09283            6      18            0

1 2024-01-10 00:05:00  1.09284  1.09285  1.09237  1.09256           19       7            0

2 2024-01-10 00:10:00  1.09263  1.09284  1.09263  1.09263           15      16            0

3 2024-01-10 00:15:00  1.09257  1.09288  1.09257  1.09283            8      13            0

4 2024-01-10 00:20:00  1.09283  1.09287  1.09283  1.09284           64      15            0

5 2024-01-10 00:25:00  1.09285  1.09286  1.09265  1.09272           17      15            0

6 2024-01-10 00:30:00  1.09273  1.09286  1.09273  1.09286           23      19            0

7 2024-01-10 00:35:00  1.09286  1.09288  1.09283  1.09288           11      17            0

8 2024-01-10 00:40:00  1.09288  1.09288  1.09282  1.09288            9      13            0

9 2024-01-10 00:45:00  1.09288  1.09289  1.09286  1.09289           12      11            0

Same problem.

 

Data Science and ML (Part 32): Keeping your AI models updated, Online Learning

Data Science and ML (Part 32): Keeping your AI models updated, Online Learning

Online machine learning is a machine learning method in which the model incrementally learns from a stream of data points in real time. It’s a dynamic process that adapts its predictive algorithm over time, allowing the model to change as new data arrives. This method is incredibly significant in rapidly evolving data-rich environments such as in trading data as it can provide timely and accurate predictions.
Data Science and ML (Part 32): Keeping your AI models updated, Online Learning
Data Science and ML (Part 32): Keeping your AI models updated, Online Learning
  • www.mql5.com
In the ever-changing world of trading, adapting to market shifts is not just a choice—it's a necessity. New patterns and trends emerge everyday, making it harder even the most advanced machine learning models to stay effective in the face of evolving conditions. In this article, we’ll explore how to keep your models relevant and responsive to new market data by automatically retraining.
 

Developing a trading robot in Python (Part 3): Implementing a model-based trading algorithm

Developing a trading robot in Python (Part 3): Implementing a model-based trading algorithm

In the first article of the series, we loaded the dataset, placed labels, enriched the dataset and also performed dataset labeling. The second article was devoted to the creation and training of the model, as well as implementation of cross-validation and bagging. 

Now that our model is trained and tested, it is time to start real trading using the MetaTrader 5 library for Python. This powerful library allows us to automate trading directly through Python using the functions and classes provided by the MetaTrader 5 platform.

Developing a trading robot in Python (Part 3): Implementing a model-based trading algorithm
Developing a trading robot in Python (Part 3): Implementing a model-based trading algorithm
  • www.mql5.com
We continue the series of articles on developing a trading robot in Python and MQL5. In this article, we will create a trading algorithm in Python.
 

Feature Engineering With Python And MQL5 (Part III): Angle Of Price (2) Polar Coordinates

Feature Engineering With Python And MQL5 (Part III): Angle Of Price (2) Polar Coordinates

We will tackle the problem of price to angle conversion from an entirely fresh perspective. This time, we will be using a more mathematically sophisticated and robust approach in comparison to the tools we created on our first attempt. Readers who are already familiar with polar coordinates should feel free to jump straight to the “Getting Started in MQL5” section, to see how these mathematical tools are implemented in MQL5. 
Feature Engineering With Python And MQL5 (Part III): Angle Of Price (2) Polar Coordinates
Feature Engineering With Python And MQL5 (Part III): Angle Of Price (2) Polar Coordinates
  • www.mql5.com
In this article, we take our second attempt to convert the changes in price levels on any market, into a corresponding change in angle. This time around, we selected a more mathematically sophisticated approach than we selected in our first attempt, and the results we obtained suggest that our change in approach may have been the right decision. Join us today, as we discuss how we can use Polar coordinates to calculate the angle formed by changes in price levels, in a meaningful way, regardless of which market you are analyzing.
 

Multiple Symbol Analysis With Python And MQL5 (Part 3): Triangular Exchange Rates

Multiple Symbol Analysis With Python And MQL5 (Part 3): Triangular Exchange Rates

Financial markets are inherently noisy. It is common for traders to suffer unnecessary drawdowns caused by false trading signals that encouraged the trader to open his positions prematurely. There are many different trading strategies and principles that have been developed in light of this issue. Most of these axioms essentially teach the trader to wait before acting, and instead seek alternative sources of confirmation or additional signs of strength.

Multiple Symbol Analysis With Python And MQL5 (Part 3): Triangular Exchange Rates
Multiple Symbol Analysis With Python And MQL5 (Part 3): Triangular Exchange Rates
  • www.mql5.com
Traders often face drawdowns from false signals, while waiting for confirmation can lead to missed opportunities. This article introduces a triangular trading strategy using Silver’s pricing in Dollars (XAGUSD) and Euros (XAGEUR), along with the EURUSD exchange rate, to filter out noise. By leveraging cross-market relationships, traders can uncover hidden sentiment and refine their entries in real time.
 

Hi

Can some guide me if iCustom indicator data of MQL can be fetched in Python.

My efforts to search online for solution did not helped much.

Thanks in advance.

 
Anil Varma iCustom indicator data from MQL in Python.

My attempts to find a solution on the internet did not help much.

Thank you in advance.

You can't use standard tools.

 
Aleksey Vyazmikin #:

You can't use standard tools.

Hi Aleksey

So what is the alternative way or non standard tool?

 
Anil Varma #:

Hello Alexei.

So what is the alternative way or non-standard tool?

The simplest one - you can save the indicator data to a csv file and read it later from the required language.

 
Aleksey Vyazmikin #:

The simplest one - you can save the indicator data to a csv file and read it later from the required language.

Thanks a lot, I thought about this too :)