| _Leverage_ | | | |
| leverage | `proposed_leverage` | float [1.0, max_leverage] | Leverage. Fallback to `proposed_leverage` for the pair. |
| _Exit pricing_ | | | |
-| exit_pricing.trade_price_target_method | `moving_average` | enum {`moving_average`,`quantile_interpolation`,`weighted_average`} | Trade NATR (Normalized Average True Range) computation method. |
+| exit_pricing.trade_natr_method | `moving_average` | enum {`moving_average`,`quantile_interpolation`,`weighted_average`} | Trade NATR (Normalized Average True Range) aggregation method used to derive stoploss and take-profit distances. |
| exit_pricing.final_take_profit_retracement_fraction | 0.25 | float (0,1] | Fraction of the final take-profit target distance used as the frozen trailing retracement distance after the final target arms the exit. The final exit tracks the best subsequent per-candle rate and exits only after this material adverse move; elapsed stagnation alone does not exit. Plot annotations show only the current trail boundary from the candle that established it; earlier boundaries are not retained. |
| _Reversal confirmation_ | | | |
| reversal_confirmation.lookback_period_candles | 0 | int >= 0 | Prior confirming candles; 0 = none. With confirmation enabled, unmeasurable history rejects entries, while a valid current exit may still reduce exposure. |
EXTREMA_WEIGHT_COLUMN,
EXTREMA_WEIGHT_SMOOTHED_COLUMN,
LABEL_COLUMNS,
- TRADE_PRICE_TARGETS,
+ TRADE_NATR_METHODS,
OptunaNamespace,
alligator,
bottom_log_return,
return get_exit_pricing_config(self.config.get("exit_pricing"), logger)
@property
- def trade_price_target_method(self) -> str:
- return str(self.exit_pricing["trade_price_target_method"])
+ def trade_natr_method(self) -> str:
+ return str(self.exit_pricing["trade_natr_method"])
@property
def final_take_profit_retracement_fraction(self) -> float:
)
logger.info("Exit Pricing:")
- logger.info(f" trade_price_target_method: {self.trade_price_target_method}")
+ logger.info(f" trade_natr_method: {self.trade_natr_method}")
logger.info(
" final_take_profit_retracement_fraction: "
f"{format_number(self.final_take_profit_retracement_fraction)}"
def get_trade_natr(
self, df: DataFrame, trade: Trade, trade_duration_candles: int
) -> Optional[float]:
- trade_price_target_methods: dict[str, Callable[[], Optional[float]]] = {
+ trade_natr_methods: dict[str, Callable[[], Optional[float]]] = {
# 0 - "moving_average"
- TRADE_PRICE_TARGETS[0]: lambda: self.get_trade_moving_average_natr(
+ TRADE_NATR_METHODS[0]: lambda: self.get_trade_moving_average_natr(
df, trade.pair, trade_duration_candles
),
# 1 - "quantile_interpolation"
- TRADE_PRICE_TARGETS[1]: lambda: self.get_trade_quantile_interpolation_natr(
+ TRADE_NATR_METHODS[1]: lambda: self.get_trade_quantile_interpolation_natr(
df, trade
),
# 2 - "weighted_average"
- TRADE_PRICE_TARGETS[2]: lambda: self.get_trade_weighted_average_natr(
+ TRADE_NATR_METHODS[2]: lambda: self.get_trade_weighted_average_natr(
df, trade
),
}
- trade_price_target_method_fn = trade_price_target_methods.get(
- self.trade_price_target_method
- )
- if trade_price_target_method_fn is None:
+ trade_natr_method_fn = trade_natr_methods.get(self.trade_natr_method)
+ if trade_natr_method_fn is None:
raise ValueError(
enum_error_message(
- "trade_price_target_method",
- self.trade_price_target_method,
- TRADE_PRICE_TARGETS,
+ "trade_natr_method",
+ self.trade_natr_method,
+ TRADE_NATR_METHODS,
)
)
- return trade_price_target_method_fn()
+ return trade_natr_method_fn()
@staticmethod
def get_trade_exit_stage(trade: Trade) -> int:
)
-TradePriceTarget = Literal[
+TradeNatrMethod = Literal[
"moving_average", "quantile_interpolation", "weighted_average"
]
-TRADE_PRICE_TARGETS: Final[tuple[TradePriceTarget, ...]] = (
+TRADE_NATR_METHODS: Final[tuple[TradeNatrMethod, ...]] = (
"moving_average",
"quantile_interpolation",
"weighted_average",
"exit_pricing.trade_price_target",
"exit_pricing.trade_price_target_method",
),
+ _renamed_config_key(
+ "exit_pricing.trade_price_target_method",
+ "exit_pricing.trade_natr_method",
+ ),
_renamed_config_key(
"reversal_confirmation.lookback_period",
"reversal_confirmation.lookback_period_candles",
DEFAULTS_EXIT_PRICING: Final[dict[str, Any]] = {
- "trade_price_target_method": TRADE_PRICE_TARGETS[0], # "moving_average"
+ "trade_natr_method": TRADE_NATR_METHODS[0], # "moving_average"
"final_take_profit_retracement_fraction": 0.25,
}
_EXIT_PRICING_SPECS: Final[dict[str, _ParamSpec]] = {
- "trade_price_target_method": _ParamSpec(
- _EnumValidator(TRADE_PRICE_TARGETS), output_type=str
+ "trade_natr_method": _ParamSpec(
+ _EnumValidator(TRADE_NATR_METHODS), output_type=str
),
"final_take_profit_retracement_fraction": _ParamSpec(
_NumericValidator(min_value=0, max_value=1, min_exclusive=True),