Change something for the strategy
This commit is contained in:
+14
@@ -91,6 +91,7 @@ class ChanLun():
|
|||||||
klc_list = self.get_klc_list(dataframe)
|
klc_list = self.get_klc_list(dataframe)
|
||||||
bi_list= self.cal_bi_list(klc_list)
|
bi_list= self.cal_bi_list(klc_list)
|
||||||
def get_klc_state_list(self, dataframe):
|
def get_klc_state_list(self, dataframe):
|
||||||
|
klu_list = self.get_klu_list(dataframe)
|
||||||
klc_list = self.get_klc_list(dataframe)
|
klc_list = self.get_klc_list(dataframe)
|
||||||
bi_list= self.cal_bi_list(klc_list)
|
bi_list= self.cal_bi_list(klc_list)
|
||||||
state_list = []
|
state_list = []
|
||||||
@@ -116,10 +117,23 @@ class ChanLun():
|
|||||||
state_list.append("00")
|
state_list.append("00")
|
||||||
else:
|
else:
|
||||||
state_list.append("00")
|
state_list.append("00")
|
||||||
|
klu = klu_list[index]
|
||||||
|
if klu.volume_ratio > 4.0:
|
||||||
|
if klu.close < klu.open:
|
||||||
|
state_list[-1] = "99"
|
||||||
|
print(klu.time, klu.volume_ratio, "99")
|
||||||
|
else:
|
||||||
|
state_list[-1] = "-99"
|
||||||
|
print(klu.time, klu.volume_ratio, "-99")
|
||||||
else:
|
else:
|
||||||
for index in range(0, len(dataframe)):
|
for index in range(0, len(dataframe)):
|
||||||
state_list.append("00")
|
state_list.append("00")
|
||||||
return state_list
|
return state_list
|
||||||
|
def get_all_state(self, df_list):
|
||||||
|
state_list = []
|
||||||
|
for df in df_list:
|
||||||
|
state_list.append(self.get_klc_state_list(df))
|
||||||
|
return state_list
|
||||||
def print_data(self, dataframe):
|
def print_data(self, dataframe):
|
||||||
klc_list = self.get_klc_list(dataframe)
|
klc_list = self.get_klc_list(dataframe)
|
||||||
bi_list = self.cal_bi_list(klc_list)
|
bi_list = self.cal_bi_list(klc_list)
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -61,7 +61,8 @@ class ChanLun_SOL_5(IStrategy):
|
|||||||
"3600": 0
|
"3600": 0
|
||||||
}
|
}
|
||||||
can_short = False
|
can_short = False
|
||||||
stoploss = -0.30
|
lev = 5.0
|
||||||
|
stoploss = -0.3 * lev
|
||||||
trailing_stop = False
|
trailing_stop = False
|
||||||
trailing_stop_positive = 0.025
|
trailing_stop_positive = 0.025
|
||||||
trailing_stop_positive_offset = 0.045
|
trailing_stop_positive_offset = 0.045
|
||||||
@@ -177,7 +178,7 @@ class ChanLun_SOL_5(IStrategy):
|
|||||||
#self.print_macd_div_list(dataframe)
|
#self.print_macd_div_list(dataframe)
|
||||||
#self.print_resample_df(dataframe, 1, 50)
|
#self.print_resample_df(dataframe, 1, 50)
|
||||||
#self.chan.get_bi_list(dataframe_30)
|
#self.chan.get_bi_list(dataframe_30)
|
||||||
if self.last_time + timedelta(minutes=1) < datetime.now():
|
if self.last_time + timedelta(minutes=1) < datetime.now() and False:
|
||||||
#print(informative.iloc[-1])
|
#print(informative.iloc[-1])
|
||||||
#self.print_klc(dataframe, "1m: ")
|
#self.print_klc(dataframe, "1m: ")
|
||||||
#self.print_klc(dataframe_5, "5m: ")
|
#self.print_klc(dataframe_5, "5m: ")
|
||||||
@@ -474,7 +475,8 @@ class ChanLun_SOL_5(IStrategy):
|
|||||||
dataframe.loc[
|
dataframe.loc[
|
||||||
(
|
(
|
||||||
#(dataframe['state'] == "-30")
|
#(dataframe['state'] == "-30")
|
||||||
(dataframe['resample_{}_state'.format(self.get_ticker_indicator()*self.time5)].shift(self.time5) == "-10")
|
(dataframe['resample_{}_state'.format(self.get_ticker_indicator()*self.time5)].shift(self.time5) == "-10") |
|
||||||
|
(dataframe['resample_{}_state'.format(self.get_ticker_indicator()*self.time5)] == "99")
|
||||||
#(dataframe['resample_{}_state'.format(self.get_ticker_indicator()*self.time5)].shift(self.time5) == "-10") &
|
#(dataframe['resample_{}_state'.format(self.get_ticker_indicator()*self.time5)].shift(self.time5) == "-10") &
|
||||||
#(dataframe['resample_{}_state'.format(self.get_ticker_indicator()*self.time30)] == "-10") &
|
#(dataframe['resample_{}_state'.format(self.get_ticker_indicator()*self.time30)] == "-10") &
|
||||||
#(dataframe['resample_{}_state'.format(self.get_ticker_indicator()*self.time5)].shift(self.time5) == "-10")
|
#(dataframe['resample_{}_state'.format(self.get_ticker_indicator()*self.time5)].shift(self.time5) == "-10")
|
||||||
@@ -496,7 +498,8 @@ class ChanLun_SOL_5(IStrategy):
|
|||||||
dataframe.loc[
|
dataframe.loc[
|
||||||
(
|
(
|
||||||
#(dataframe['state']== "30")
|
#(dataframe['state']== "30")
|
||||||
(dataframe['resample_{}_state'.format(self.get_ticker_indicator()*self.time5)].shift(self.time5) == "10")
|
(dataframe['resample_{}_state'.format(self.get_ticker_indicator()*self.time5)].shift(self.time5) == "10") |
|
||||||
|
(dataframe['resample_{}_state'.format(self.get_ticker_indicator()*self.time5)] == "-99")
|
||||||
#(dataframe['resample_{}_state'.format(self.get_ticker_indicator()*self.time30)] == "10") &
|
#(dataframe['resample_{}_state'.format(self.get_ticker_indicator()*self.time30)] == "10") &
|
||||||
#(dataframe['resample_{}_state'.format(self.get_ticker_indicator()*self.time60)] == "10")
|
#(dataframe['resample_{}_state'.format(self.get_ticker_indicator()*self.time60)] == "10")
|
||||||
),
|
),
|
||||||
@@ -513,7 +516,7 @@ class ChanLun_SOL_5(IStrategy):
|
|||||||
def leverage(self, pair: str, current_time: datetime, current_rate: float,
|
def leverage(self, pair: str, current_time: datetime, current_rate: float,
|
||||||
proposed_leverage: float, max_leverage: float, entry_tag: Optional[str], side: str,
|
proposed_leverage: float, max_leverage: float, entry_tag: Optional[str], side: str,
|
||||||
**kwargs) -> float:
|
**kwargs) -> float:
|
||||||
return 1.0
|
return self.lev
|
||||||
|
|
||||||
def get_ticker_indicator(self):
|
def get_ticker_indicator(self):
|
||||||
return int(self.timeframe[:-1])
|
return int(self.timeframe[:-1])
|
||||||
Reference in New Issue
Block a user