add_pivot(i, highs[i], TrendDirection.UP)
state = TrendDirection.UP
- final_pos = len(df) - 1
- last_pivot_val = pivots_values[-1]
- if state == TrendDirection.UP:
- if (
- (last_pivot_val - lows[final_pos]) / last_pivot_val >= thresholds[final_pos]
- and (final_pos - last_pivot_pos) >= depth
- and is_fractal_low[final_pos]
- and indices[final_pos] != pivots_indices[-1]
- ):
- add_pivot(final_pos, lows[final_pos], TrendDirection.DOWN)
- elif state == TrendDirection.DOWN:
- if (
- (highs[final_pos] - last_pivot_val) / last_pivot_val
- >= thresholds[final_pos]
- and (final_pos - last_pivot_pos) >= depth
- and is_fractal_high[final_pos]
- and indices[final_pos] != pivots_indices[-1]
- ):
- add_pivot(final_pos, highs[final_pos], TrendDirection.UP)
-
return pivots_indices, pivots_values, pivots_directions
return self.get_label_natr_ratio(pair) * 0.015
def get_stoploss_natr_ratio(self, pair: str) -> float:
- return self.get_label_natr_ratio(pair) * 0.65
+ return self.get_label_natr_ratio(pair) * 0.675
def get_take_profit_natr_ratio(self, pair: str) -> float:
- return self.get_stoploss_natr_ratio(pair) * 0.825
+ return self.get_stoploss_natr_ratio(pair) * 0.8
def set_freqai_targets(self, dataframe: DataFrame, metadata: dict, **kwargs):
pair = str(metadata.get("pair"))
add_pivot(i, highs[i], TrendDirection.UP)
state = TrendDirection.UP
- final_pos = len(df) - 1
- last_pivot_val = pivots_values[-1]
- if state == TrendDirection.UP:
- if (
- (last_pivot_val - lows[final_pos]) / last_pivot_val >= thresholds[final_pos]
- and (final_pos - last_pivot_pos) >= depth
- and is_fractal_low[final_pos]
- and indices[final_pos] != pivots_indices[-1]
- ):
- add_pivot(final_pos, lows[final_pos], TrendDirection.DOWN)
- elif state == TrendDirection.DOWN:
- if (
- (highs[final_pos] - last_pivot_val) / last_pivot_val
- >= thresholds[final_pos]
- and (final_pos - last_pivot_pos) >= depth
- and is_fractal_high[final_pos]
- and indices[final_pos] != pivots_indices[-1]
- ):
- add_pivot(final_pos, highs[final_pos], TrendDirection.UP)
-
return pivots_indices, pivots_values, pivots_directions