-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify_single.py
More file actions
72 lines (59 loc) · 1.73 KB
/
verify_single.py
File metadata and controls
72 lines (59 loc) · 1.73 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import time
import warnings
from copy import deepcopy
from analysis.Engine import Engine
from strategy.LiveParams import LiveParams
from strategy.LiveStrategy import LiveStrategy
from utils.metrics import print_metrics
from utils.utils import *
''' single engine verify to tradingview'''
# INPUT ###########################################################
asset = '6E'
num_months = 20
isNetwork = False
params = LiveParams(
fastMinutes = 25,
disableEntryMinutes = 115,
fastMomentumMinutes = 138,
fastCrossoverPercent = 0,
takeProfitPercent = 0.08,
stopLossPercent = 0,
fastAngleEntryFactor = 25,
fastAngleExitFactor = 2450,
slowMinutes = 2535,
slowAngleFactor = 10,
coolOffMinutes = 20,
trendStartHour = 4,
trendEndHour = 80
)
###################################################################
os.system('clear')
warnings.filterwarnings('ignore')
np.set_printoptions(threshold = 3)
start_time = time.time()
# organize outputs
data_name = asset + '_' + str(num_months) + 'm'
data_path = 'data/' + data_name
parent_path = 'single/' + data_name
id = format_timestamp(datetime.now(), 'local')
# init data
data = getOhlc(asset, num_months, isNetwork)
# get indicators
# emas = unpack('emas', data_path)
# fractals = unpack('fractals', data_path)
# init indicators
opt = deepcopy(params)
opt.fastMinutes = [params.fastMinutes]
opt.slowMinutes = [params.slowMinutes]
emas, fractals = getIndicators(data, opt, data_path)
# define strategy
strategy = LiveStrategy(data, emas, fractals, params)
engine = Engine(id, strategy)
engine.run(disable = False)
engine.save(parent_path, False)
# display results
engine.print_metrics()
engine.print_trades()
engine.plot_trades()
engine.plot_equity(shouldShow = False)
fplt.show()