Opt.jl
1 """ 2 Optimization 3 4 The `Optimization` module provides tools and abstractions for defining, configuring, and executing optimization routines within the Planar.jl framework. It is designed to support a variety of optimization strategies, including parameter tuning, strategy selection, and performance evaluation for trading systems and related applications. The module integrates seamlessly with other Planar.jl components, ensuring type safety, extensibility, and efficient execution. 5 6 Main features: 7 - Flexible optimization workflows for trading strategies and system parameters 8 - Integration with Planar.jl's data, strategy, and execution layers 9 - Support for precompilation and dynamic loading 10 - Extensible design for custom optimization algorithms 11 12 # Comparison of Search Methods 13 14 | Function | Data Segmentation | Parameter Selection | Main Use Case | 15 |---------------|--------------------------|----------------------------|------------------------------------------------| 16 | progsearch | Segments by offset | Filters after each round | Robustness across data segments | 17 | broadsearch | Slices by fixed size | Filters after each slice | Adapting to changing regimes over time | 18 | slidetest | Slides by timeframe | No parameter search | Granular, rolling/walk-forward backtesting | 19 20 - `progsearch`: Progressive grid search with filtering and offsetting for robustness. 21 - `broadsearch`: Sequential grid search over contiguous slices, filtering at each step. 22 - `slidetest`: Sliding window backtest, moving by the smallest timeframe increment. 23 24 # User-facing Optimization/Search Functions 25 26 - `gridsearch(s::Strategy; ...)`: Grid search over parameter combinations for a strategy. 27 - `progsearch(s::Strategy; ...)`: Progressive search, running multiple grid searches with filtering and resampling. 28 - `slidetest(s::Strategy; ...)`: Slides a window over the backtesting period, running optimizations at each step. 29 - `broadsearch(s::Strategy; ...)`: Performs a broad search by slicing the context and optimizing in each slice. 30 - `optimize(s::Strategy; ...)`: Black-box optimization using the Optimization.jl framework (supports global optimization algorithms). 31 - `boptimize!(s::Strategy; ...)`: Bayesian optimization using Gaussian Processes (requires BayesExt and BayesianOptimization.jl). 32 """ 33 module Opt 34 35 if get(ENV, "JULIA_NOPRECOMP", "") == "all" 36 __init__() = begin 37 @eval include(joinpath(@__DIR__, "module.jl")) 38 end 39 else 40 occursin(string(@__MODULE__), get(ENV, "JULIA_NOPRECOMP", "")) && __precompile__(false) 41 include("module.jl") 42 if occursin(string(@__MODULE__), get(ENV, "JULIA_PRECOMP", "")) 43 include("precompile.jl") 44 end 45 end 46 47 end # module Plotting