For this tutorial, I assume you have Metatrader5 installed and access to a free demo account.
I will be using VSCode because this is easy to get up and running, but you may choose to use your preferred ipython
interface, like jupyter lab.
Attention: Many python modules are compiled and built when you install them on your machine. On Windows, you need to install the Build Tools for Visual Studio to make this process run smoothly. Please, download it from here, install it and save your self hours of search on StackOverflow.
For python development on Windows enviroment, I recommend WinPython. It is a lightweght "portable" python setup that requires no installation and comes with no extra modules, just plain python.
The advantage of this recommended setup is that you will be able to code along without interfering with any previous python installation you may have or previously installed modules, and thus, prevent version issues.
You can download it from the Project's Github page.
- Extract the file content to a path on your PC (I will use
C:\dev\apps
). - This will create a folder called
WPy64-3920
under the selected extraction folder (if you used the same folder as me, the final result will beC:\dev\apps\WPy64-3920
). - This is the location where your base interpreter is.
- Optional but recommended: create an isolated python enviroment for the tutorial, installing the
virtualenv
.- Open a command prompt (windows key +
run cmd
). - Run
C:\dev\apps\WPy64-3920\Scripts\env.bat
. This will setup just that command prompt terminal. You must run this batch file on every terminal where you want to run python modules. - To check if everything is working fine, run:
python --version
andwhere python
. The result should be like this: - Install
virtualenv
:pip install virtualenv
. Your terminal now should look like this: - Clone this repository:
- If you want to mimic my folder structure, run:
md C:\dev\workspaces\workspace_python\ && cd C:\dev\workspaces\workspace_python\
. This will create the folder and change the prompt to that location. - Clone:
git clone https://github.com/rafaelqntn/cfi_mt5_python.git
- Change the directory to the tutorial's folder:
cd cfi_mt5_python
- If you want to mimic my folder structure, run:
- With the command prompt in the tutorial's folder, create the
virtualenv
running:virtualenv venv
- Activate the virtualenv running:
.\venv\Scripts\activate.bat
. The result should look like this: - Install the required python modules running:
pip install -r requirements.txt
- Open a command prompt (windows key +
- Optional but recommended: create an isolated python enviroment for the tutorial, installing the
- Open the folder using VSCode typing:
code .
(the dot "." means "current directory"). This will open the folder inside VSCode.- Details to notice:
- VSCode should prompt you to install the right extension to open jupyter notebooks and spin up a local server for you. This is the extension I am talking about:
- The selected python interpreter must point to the interpreter where you have installed the required modules.
- VSCode must be connected to your jupyter server.
- VSCode should prompt you to install the right extension to open jupyter notebooks and spin up a local server for you. This is the extension I am talking about:
- Details to notice:
You can now open the jupyter notebooks and continue the tutorial.