visualise_grid_search_equity_curves#
API documentation for tradeexecutor.visual.grid_search_basic.visualise_grid_search_equity_curves Python function.
- visualise_grid_search_equity_curves(results, name=None, benchmark_indexes=None, height=1200, colour=None, log_y=False, alpha=0.7, label_func=None, annotation_xshift=200)[source]#
- Draw multiple equity curves in the same chart. - See how all grid searched strategies work 
- Benchmark against buy and hold of various assets 
- Benchmark against hold all cash 
 - TODO: A lot of parameter descriptions are not up-to-date. - Note - Only good up to ~hundreds results. If more than thousand result, rendering takes too long time. - Example that draws equity curve comparison with custom labels: - from tradeexecutor.visual.grid_search_basic import visualise_grid_search_equity_curves from tradeexecutor.analysis.multi_asset_benchmark import get_benchmark_data # Automatically create BTC and ETH buy and hold benchmark if present # in the trading universe benchmark_indexes = get_benchmark_data( strategy_universe, cumulative_with_initial_cash=Parameters.initial_cash, ) fig = visualise_grid_search_equity_curves( grid_search_results, benchmark_indexes=benchmark_indexes, log_y=False, label_func=lambda x: f"Decision cycle {x.get_parameter('cycle_duration').value}, CARG {x.get_cagr():.0%}, Sharpe {x.get_sharpe():.1f}", ) fig.show() - Example that draws equity curves of a grid search results. - from tradeexecutor.visual.grid_search_basic import visualise_grid_search_equity_curves from tradeexecutor.analysis.multi_asset_benchmark import get_benchmark_data # Automatically create BTC and ETH buy and hold benchmark if present # in the trading universe benchmark_indexes = get_benchmark_data( strategy_universe, cumulative_with_initial_cash=ShiftedStrategyParameters.initial_cash, ) fig = visualise_grid_search_equity_curves( grid_search_results, name="8h clock shift, stop loss added and adjusted momentum", benchmark_indexes=benchmark_indexes, log_y=False, ) fig.show() - Parameters:
- results (List[GridSearchResult]) – Results from the grid search. 
- benchmark_indexes (pandas.core.frame.DataFrame | None) – - List of other asset price series displayed on the timeline besides equity curve. - DataFrame containing multiple series. - Asset name is the series name. 
- Setting colour for pd.Series.attrs allows you to override the colour of the index 
 
- height – Chart height in pixels 
- colour – Colour of the equity curve e.g. “rgba(160, 160, 160, 0.5)”. If provided, all equity curves will be drawn with this colour. 
- start_at – When the backtest started 
- end_at – When the backtest ended 
- additional_indicators – - Additional technical indicators drawn on this chart. - List of indicator names. - The indicators must be plotted earlier using state.visualisation.plot_indicator(). - Note: Currently not very useful due to Y axis scale 
- log_y – - Use logarithmic Y-axis. - Because we accumulate larger treasury over time, the swings in the value will be higher later. We need to use a logarithmic Y axis so that we can compare the performance early in the strateg and late in the strategy. 
- label_func (Callable) – Create custom legend to compare 
- name (str | None) – 
 
- Return type:
- Figure