Never execute an order the wrong way again

Photo by Aarón Blanco Tejedor on Unsplash

Closing your orders in MetaTrader 5 with Python
If you are developing your algotrading strategy using Python and MetaTrader, you have undoubtedly faced the need to send your orders using Python. Sending purchase or sale orders is relatively simple. However, closing them can make you get an unwelcome headache. In this post, I will teach you how to close orders correctly.

If what I’m saying is new to you, I invite you to read my article on integration between Python and MetaTrader 5:

Collecting information about your orders

First of all, we will prepare our development environment to carry out our operations. …


The most reliable way to integrate and collect financial market data for your analysis.

Photo by Luke Chesser on Unsplash

Developing investment strategies based on data requires confidence and speed in data collection. Any failure in the collection process, normally caused by the providers, can have catastrophic consequences on your investments. In this blog, I will demonstrate a strong solution on how to collect data using the Intrinio API using Python.

Installing the Libraries

If you already have Python installed on your computer, open the terminal and install the necessary libraries with the command:

pip install intrinio_sdk
pip install pandas
pip install matplotlib

Collecting the Data

We arrived at the interesting part. We will start the development of our small data collection program.

The first step…


Testando o subtítulo.

Photo by Paul Gaudriault on Unsplash

Estou testando a função Newsletter do Medium. Nessa news vou contar como irei alcançar a independência financeira em menos de 10 anos, ou melhor, 7 anos. Tenho o objetivo de estar aposentado, desfrutando das coisas boas da vida aos 40 anos. Assine abaixo para receber minhas histórias diretamente no seu e-mail.

Vamos lá.


Learn how to build a bot to receive real-time market data using Python and Metatrader 5

Photo by Austin Distel on Unsplash

One of the most significant advantages of developing investment automation strategies is the possibility of not having to stand in front of the screens computers all the time to identify the best opportunities on the market. Thinking about it, I developed a bot for the Telegram that informs me which assets suffered the most falls or highs in the day, and I will show you step by step so you can develop yours!

In this blog, we will focus on developing a simple application that sends a request to the Bot on Telegram, and it returns the top five and…


The fastest way to integrate collecting and analyzing financial market data for your analysis.

Photo by Austin Distel on Unsplash

In one of my last posts, I showed how to create graphics using the Plotly library. To do this, we import data from MetaTrader in a ‘raw’ way without automation. Today, we will learn how to automate this process and plot a heatmap graph of the correlations of different assets in just a few lines of code.

How to integrate Python and MetaTrader? I follow the following steps:

  • Having installed MetaTrader 5 and Python 3.8 on your machine
  • Installing the Python libraries: MetaTrader5, matplotlib, and pandas
  • Importing the data
  • Plot the Graph

Installing the Libraries

If you already have Python installed on your…


The outcomes of picking stocks by random, an experiment of 77 weeks

Photo by Patrick Fore on Unsplash

Before you start throwing stones at me because of the titles, I want to make a few things clear. This post intends to teach some skills in R, such as: drawing elements from a data set, downloading financial data from the stock exchange, downloading data from a google spreadsheet, and plotting return graphs. Never use this publication to guide your investments. So come on!

You may have heard the British newspaper challenged three types of investors to a dispute over who could achieve the highest profitability at the end of 2012, following them throughout the year. Nothing unusual about that…


Photo by Austin Distel on Unsplash

The step by step you need to predict the stock price of companies, and please read the disclaimer.

In this post, I show the step-by-step method of making stock price predictions using the R language ,and the H2o.ai Framework. Please understand that this article is only a simple demonstration on how to get start using the H2O.ai Framework. It’s not a financial advise. Don’t take any financial decision based on this post.

The Framework is also available in Python, however, as I am more familiar with R, I will present the tutorial in that language. You may have already asked yourself: how to predict the stock price using artificial intelligence? Here are the steps to do it:

  1. Collect…


Photo by Nick Chong on Unsplash

A step-by-step guide on how to create candlesticks charts from real asset data using the Plotly package.

In this article I show how to use the Plotly package to visualize financial data in high frequency using R. To perform analysis and develop trading algorithms, it is necessary to obtain data in very high frequencies to be able to take quick and accurate actions to maximize the profits earned in the trades.

Today, more than 40% of the operations carried out on American stock exchanges are carried out by robots programmed to analyze the market and buy or sell according to market indicators. …


A math game that will make you dance!

Teaching math is not a trivial task. Take a short survey with your students, or anyone else, to find out which discipline they like best, and math will probably not be the subject of their choice.

I still think that the traditional classroom settings does not allow student’s engagement in the way a teacher wants. Usually, classes are boring, tiring and useless. Mathematics taught in the classroom should provide theoretical and methodological tools for solving real-world problems rather than creating human computing machines.

Thinking about this issue, and knowing that video game has an incredible power of youth engagement to…

Pedro Lealdino Filho

Mathematics Education Ph.D. and Computer Science Teacher based in Brazil. Photographer. Data Science and Stock Market enthusiast. Building wealth through data.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store