mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-12-19 06:11:15 +00:00
handle trade wide indicators
This commit is contained in:
@@ -144,6 +144,10 @@ This detailed view of indicator values enhances the analysis.
|
|||||||
The `(entry)` and `(exit)` suffixes are added to indicators
|
The `(entry)` and `(exit)` suffixes are added to indicators
|
||||||
to distinguish the values at the entry and exit points of the trade.
|
to distinguish the values at the entry and exit points of the trade.
|
||||||
|
|
||||||
|
!!! note "Trade-wide Indicators"
|
||||||
|
Certain trade-wide indicators do not have the `(entry)` or `(exit)` suffix. These indicators include:
|
||||||
|
`"open_date"`, `"close_date"`, `"min_rate"`, `"max_rate"`, `"profit_ratio"`, and `"profit_abs"`.
|
||||||
|
|
||||||
### Filtering the trade output by date
|
### Filtering the trade output by date
|
||||||
|
|
||||||
To show only trades between dates within your backtested timerange, supply the usual `timerange` option in `YYYYMMDD-[YYYYMMDD]` format:
|
To show only trades between dates within your backtested timerange, supply the usual `timerange` option in `YYYYMMDD-[YYYYMMDD]` format:
|
||||||
|
|||||||
@@ -303,6 +303,15 @@ def print_results(
|
|||||||
|
|
||||||
def _merge_dfs(entry_df, exit_df, available_inds):
|
def _merge_dfs(entry_df, exit_df, available_inds):
|
||||||
merge_on = ["pair", "open_date"]
|
merge_on = ["pair", "open_date"]
|
||||||
|
trade_wide_indicators = [
|
||||||
|
"open_date",
|
||||||
|
"close_date",
|
||||||
|
"min_rate",
|
||||||
|
"max_rate",
|
||||||
|
"profit_ratio",
|
||||||
|
"profit_abs",
|
||||||
|
]
|
||||||
|
signal_wide_indicators = list(set(available_inds) - set(trade_wide_indicators))
|
||||||
columns_to_keep = merge_on + ["enter_reason", "exit_reason"] + available_inds
|
columns_to_keep = merge_on + ["enter_reason", "exit_reason"] + available_inds
|
||||||
|
|
||||||
if exit_df is None or exit_df.empty:
|
if exit_df is None or exit_df.empty:
|
||||||
@@ -310,7 +319,7 @@ def _merge_dfs(entry_df, exit_df, available_inds):
|
|||||||
|
|
||||||
return pd.merge(
|
return pd.merge(
|
||||||
entry_df[columns_to_keep],
|
entry_df[columns_to_keep],
|
||||||
exit_df[merge_on + available_inds],
|
exit_df[merge_on + signal_wide_indicators],
|
||||||
on=merge_on,
|
on=merge_on,
|
||||||
suffixes=(" (entry)", " (exit)"),
|
suffixes=(" (entry)", " (exit)"),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -168,6 +168,7 @@ def test_backtest_analysis_on_entry_and_rejected_signals_nomock(
|
|||||||
assert "close (exit)" in captured.out
|
assert "close (exit)" in captured.out
|
||||||
assert "rsi (exit)" in captured.out
|
assert "rsi (exit)" in captured.out
|
||||||
assert "52.829" in captured.out
|
assert "52.829" in captured.out
|
||||||
|
assert "profit_abs" in captured.out
|
||||||
|
|
||||||
# test group 1
|
# test group 1
|
||||||
args = get_args(base_args + ["--analysis-groups", "1"])
|
args = get_args(base_args + ["--analysis-groups", "1"])
|
||||||
|
|||||||
Reference in New Issue
Block a user