mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-09-20 09:31:12 +00:00
handle trade wide indicators
This commit is contained in:
parent
08d5174d02
commit
b7145debfb
|
@ -144,6 +144,10 @@ This detailed view of indicator values enhances the analysis.
|
|||
The `(entry)` and `(exit)` suffixes are added to indicators
|
||||
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
|
||||
|
||||
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):
|
||||
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
|
||||
|
||||
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(
|
||||
entry_df[columns_to_keep],
|
||||
exit_df[merge_on + available_inds],
|
||||
exit_df[merge_on + signal_wide_indicators],
|
||||
on=merge_on,
|
||||
suffixes=(" (entry)", " (exit)"),
|
||||
)
|
||||
|
|
|
@ -168,6 +168,7 @@ def test_backtest_analysis_on_entry_and_rejected_signals_nomock(
|
|||
assert "close (exit)" in captured.out
|
||||
assert "rsi (exit)" in captured.out
|
||||
assert "52.829" in captured.out
|
||||
assert "profit_abs" in captured.out
|
||||
|
||||
# test group 1
|
||||
args = get_args(base_args + ["--analysis-groups", "1"])
|
||||
|
|
Loading…
Reference in New Issue
Block a user