optimiser_functions#
API documentation for tradeexecutor.backtest.optimiser_functions Python module in Trading Strategy.
Module description#
Functions the optimiser would be looking for.
You can also write your own optimiser functions, see
tradeexecutor.backtest.optimiser.SearchFunction
.
Example:
import logging
from tradeexecutor.backtest.optimiser import perform_optimisation
from tradeexecutor.backtest.optimiser import prepare_optimiser_parameters
from tradeexecutor.backtest.optimiser_functions import optimise_profit, optimise_sharpe
from tradeexecutor.backtest.optimiser import MinTradeCountFilter
# How many Gaussian Process iterations we do
iterations = 6
optimised_results = perform_optimisation(
iterations=iterations,
search_func=optimise_profit,
decide_trades=decide_trades,
strategy_universe=strategy_universe,
parameters=prepare_optimiser_parameters(Parameters), # Handle scikit-optimise search space
create_indicators=create_indicators,
result_filter=MinTradeCountFilter(50)
# Uncomment for diagnostics
# log_level=logging.INFO,
# max_workers=1,
)
print(f"Optimise completed, optimiser searched {optimised_results.get_combination_count()} combinations")
Classes#
Try to find a strategy with balanced Sharpe and max drawdown. |
|
Find a rolling sharpe that's stable and high. |
Functions#
|
Search for the lowest max drawdown. |
|
Search for the best CAGR value. |
|
Search for the best Sharpe value. |
Search for the best sharpe / max drawndown ratio. |
|
|
Search for the best Sortino value. |
|
Search for the best trade win rate. |