-
Notifications
You must be signed in to change notification settings - Fork 2
/
sync_multi_timeframe.py
48 lines (41 loc) · 1.38 KB
/
sync_multi_timeframe.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import pandas as pd
def sync_4h_to_1h(ohlc,indicator):
#shift 3
len = indicator.shape[0]
for i in range(0 , len):
if(i+3<=len-1):
indicator.macd[i] = indicator.macd[i+3]
indicator.macdsignal[i] = indicator.macdsignal[i+3]
return indicator
def sync_1h_to_30m(ohlc,indicator):
#shift 1
len = indicator.shape[0]
for i in range(0 , len):
if(i+1<=len-1):
indicator.macd[i] = indicator.macd[i+1]
indicator.macdsignal[i] = indicator.macdsignal[i+1]
return indicator
def sync_30m_to_15m(ohlc,indicator):
#shift 1
len = indicator.shape[0]
for i in range(0 , len):
if(i+1<=len-1):
indicator.macd[i] = indicator.macd[i+1]
indicator.macdsignal[i] = indicator.macdsignal[i+1]
return indicator
def sync_15m_to_5m(ohlc,indicator):
#shift 2
len = indicator.shape[0]
for i in range(0 , len):
if(i+2<=len-1):
indicator.macd[i] = indicator.macd[i+2]
indicator.macdsignal[i] = indicator.macdsignal[i+2]
return indicator
def sync_5m_to_1m(ohlc,indicator):
#shift 4
len = indicator.shape[0]
for i in range(0 , len):
if(i+4<=len-1):
indicator.macd[i] = indicator.macd[i+4]
indicator.macdsignal[i] = indicator.macdsignal[i+4]
return indicator