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

 
fxsaber:

Unfortunately, without the source code, this opportunity remains just words to me. There's a lot I don't know, and the start of self-study should probably be something practical to start with, something you can spin right away.

If you're just starting out, it's better to get familiar with the language itself, it's very different from C++.

otherwise, it's packages... lots of packages/modules for all occasions that are googled

 
Maxim Dmitrievsky:

If you are just starting out, it is better to understand the specifics of the language itself, it is very different from C++.

Otherwise, it's packages... lots of packages/modules for all occasions, which are googled

Trying to answer at least primitively for myself the question "what can I use it for?". The answer "for self-development" is not accepted for a long time.

Therefore, I would like to see various cool examples from various fields in this thread. The most effect-causing one is visualisation, which everyone can try.


To calculate a correlation matrix with its graphical representation does not catch on, unfortunately.

 
fxsaber:

Trying to answer at least primitively for myself the question "what can I use it for?". The answer "for self-development" is long overdue.

So I'd like to see various cool examples from different fields in this thread. The most effect-causing one is visualisation, which everyone can try.


To calculate a correlation matrix with its graphic representation - doesn't catch on, unfortunately.

I guess we have different ideas of beauty, I don't need visualisation at all and it doesn't evoke any emotion at all

 
Maxim Dmitrievsky:

I guess we have different ideas of what is beautiful - I don't need visualisation at all and it doesn't evoke any emotion at all.

I have never touched on the notion of beauty or the need for visualisation in this thread. I was talking about something else entirely.

 
fxsaber:

I have never touched on the notion of beauty or the need for visualisation in this thread. I was talking about something else entirely.

I uploaded the ticks to a graph like this (1 million), you can save it in html

# -*- coding: utf-8 -*-
"""
Created on Thu Mar 14 16:13:03 2019

@author: dmitrievsky
"""
from MetaTrader5 import *
from datetime import datetime
import pandas as pd 

# Initializing MT5 connection 
MT5Initialize()
MT5WaitForTerminal()

print(MT5TerminalInfo())
print(MT5Version())

# Copying data to list
rates = MT5CopyTicksFrom("EURUSD", datetime(2019,1,28,13), 1000000, MT5_COPY_TICKS_ALL)
bid = [y.bid for y in rates]
ask = [y.ask for y in rates]
time = [x.time for x in rates]

# Deinitializing MT5 connection
MT5Shutdown()

import numpy as np 
import plotly.graph_objs as go
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
data = [go.Scatter(x=time, y=bid), go.Scatter(x=time, y=ask)]

plot(data)

I attached a web page, it weighs more than 70 mb of course. Like this was to surprise or something else? Scaling, all that stuff.

Files:
bidask.zip  7923 kb
 
Maxim Dmitrievsky:

Uploaded ticks to a graph like this (1 million), can be saved in html

Attached web page, weighs more than 70 mb of course. Like that should have been a surprise or something else? Scaling, all that stuff.

Well, here's a simple example showing that it's much easier and more convenient to visualize tick history in Python than in MT5. Thanks.

 
Is there any code on how to pass an array of simple structures both ways?
 
fxsaber:
Any code on how to pass an array of simple structures in both directions?

there is only sockets in byte form, I wrote a short article about exchanging through them, maybe next week.

 
Maxim Dmitrievsky:

there is only sockets in byte form, I wrote a short article about exchanging through them, maybe next week.

Byte array to structure array (and back) casting in Python will be there?

 
fxsaber:

Will the byte array to structure array in Python be there?

No, into a regular array... you need to think what is a structure array in python, is it just a dataframe object with heterogeneous data

Anyway, you need to look specifically at the problem, it's hard to say and I haven't done it before.

i can write an article later, it's the first time i'm doing it myself
Reason: