2 registered members (AndrewAMD, juanex),
1,247
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: MT4/5 - wrong M1 time
[Re: Grat]
#480398
06/04/20 11:56
06/04/20 11:56
|
Joined: May 2015
Posts: 390 Czech Republic
Grat
OP
Senior Member
|
OP
Senior Member
Joined: May 2015
Posts: 390
Czech Republic
|
I promise python compare: how to read in python hst file from MT4:
import numpy as np
import pandas as pd
def read_hst(filepath):
with open(filepath, 'rb') as f:
ver = np.frombuffer(f.read(148)[:4], 'i4')
dtype = [('time', 'u8'), ('open', 'f8'), ('high', 'f8'), ('low', 'f8'),
('close', 'f8'), ('volume', 'i8'), ('s', 'i4'), ('r', 'i8')]
df = pd.DataFrame(np.frombuffer(f.read(), dtype=dtype).astype(dtype))
df['time'] = pd.to_datetime(df['time'], unit='s')
return df
dMT4=read_hst("EURUSD15.hst")
dMT4.head()
output is:
time open high low close volume s r
0 2019-06-27 16:00:00 1.13665 1.13678 1.13618 1.13666 1489 0 0
1 2019-06-27 16:15:00 1.13665 1.13672 1.13638 1.13644 989 0 0
2 2019-06-27 16:30:00 1.13640 1.13671 1.13608 1.13627 1557 0 0
3 2019-06-27 16:45:00 1.13626 1.13628 1.13564 1.13585 1274 0 0
4 2019-06-27 17:00:00 1.13587 1.13707 1.13574 1.13699 1592 0 0
how to read in python history file from ZORRO:
def read_t6(filepath):
with open(filepath, 'rb') as f:
dtype = [('time', 'f8'), ('high', 'f4'), ('low', 'f4'), ('open', 'f4'),
('close', 'f4'), ('val', 'f4'), ('vol', 'f4')]
df = pd.DataFrame(np.frombuffer(f.read(), dtype=dtype).astype(dtype))
df['time'] = pd.to_datetime(df['time'],unit='D', origin=pd.Timestamp('1899-12-30'))
df=df.set_index("time")
ohlc_dict = {'open':'first', 'high':'max', 'low':'min', 'close': 'last'}
return df.resample('15Min').agg(ohlc_dict)
dT6=read_t6("EURUSD_2020.t6")
dT6.head()
Now I work on the compare this dataset - datetime come later....
|
|
|
Re: MT4/5 - wrong M1 time
[Re: Grat]
#480410
06/05/20 08:34
06/05/20 08:34
|
Joined: May 2015
Posts: 390 Czech Republic
Grat
OP
Senior Member
|
OP
Senior Member
Joined: May 2015
Posts: 390
Czech Republic
|
I thinking, is a problem with DST. Because now is server +3 hour's, but in the 2020/01/01 to change DST only +2hour's. For system used short period ( Timeframe < 240 ) don't depend. But for system working with H4 and D1 must have a different results. that's all folk... P.S: if anybody want, I send jupyter script for playing on sand
|
|
|
|