Skip to content

Commit 5ec11c8

Browse files
new version
1 parent bb5978f commit 5ec11c8

5 files changed

Lines changed: 213 additions & 131 deletions

File tree

indicator.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Return the values of the indicator of our choice through the desired timeframe and lenght"""
1+
"""Return the values of the indicator of our choice through the desired timeframe and interval"""
22

33
import indicators.regression.linear_regression as lr
44
import indicators.regression.mann_kendall as mk
@@ -11,19 +11,22 @@ class Indicator(InitOp):
1111
def __init__(self):
1212
super().__init__()
1313

14-
1514
def __call__(self):
1615
super().__call__()
1716

1817
def calcul_indicator(self):
19-
2018
"""Function that return the value of an indicator through desired period and the calculation lenght of the
2119
indicator
2220
23-
The indicator always take into account the value of price for the same row. Ex: We are at row 99, the indicator
24-
will take into account the data for row 99 then write the value on row 99. Basically, we have to enter or
25-
exit the market (or exit) on the next row (value)
21+
The indicator always take into account the value of the price for the same row.
22+
Ex: We are at row 99, the indicator will take into account the data for row 99 then write the value on row 99.
23+
Basically, we have to enter or exit the market (or exit) on the next row (value)
24+
25+
The function iterate through the indicators in `self.indicator` and through the range of `self.series`,defined
26+
in `init_operations.py` and function `init_series()`. Then it calculates the value of the indicator using
27+
the subseries `self.sous_series`.
2628
"""
29+
2730
super().__call__()
2831
rg = lr.RegressionSlopeStrenght(self.series,self)
2932
mk_ = mk.MannKendall(self.series,self)

init_operations.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Class with functions that initialize the program"""
1+
"""Module to easily reinitiliaze values when needed """
22

33
from initialize import Initialize
44
from manip_data import ManipData as md
@@ -15,18 +15,18 @@ def __call__(self):
1515

1616

1717
def reset_value(self):
18-
"""Value that must be reseted if we run walk-foward analysis"""
18+
"""Function to reset the dictionary that contains the trading journal (entry, exit, return).
19+
20+
We need to do that when we optimize, ie when `self.is_walkfoward` is `True` """
1921
self.trades_track = pd.DataFrame(columns=[self.entry_row, self.entry_level, self.exit_row, self.exit_level, \
2022
self.trade_return])
2123

2224
def init_series(self):
23-
"""Function to get the data as Dataframe"""
25+
"""Function that extract data from csv to a pandas Dataframe"""
2426

25-
self.series = md.csv_to_pandas(self.date_name, self.date_debut, self.date_fin, self.name,self.directory,
27+
self.series = md.csv_to_pandas(self.date_name, self.start_date, self.end_date, self.name, self.directory,
2628
self.asset, ordinal_name=self.date_ordinal_name, is_fx=self.is_fx, dup_col = self.dup_col)
2729

28-
t = 5
29-
3030
"""
3131
if self.is_detrend:
3232
self.series_test = md.de_trend(self.series,self.period, self.p_value,self.date_name,

0 commit comments

Comments
 (0)