Be explicit with space assignment in documentation

This commit is contained in:
Matthias 2021-05-03 08:33:06 +02:00
parent 4465915a94
commit f138cca797
1 changed files with 9 additions and 5 deletions

View File

@ -249,11 +249,11 @@ We continue to define hyperoptable parameters:
```python
class MyAwesomeStrategy(IStrategy):
buy_adx = IntParameter(20, 40, default=30)
buy_rsi = IntParameter(20, 40, default=30)
buy_adx_enabled = CategoricalParameter([True, False])
buy_rsi_enabled = CategoricalParameter([True, False])
buy_trigger = CategoricalParameter(['bb_lower', 'macd_cross_signal'])
buy_adx = IntParameter(20, 40, default=30, space="buy")
buy_rsi = IntParameter(20, 40, default=30, space="buy")
buy_adx_enabled = CategoricalParameter([True, False], space="buy")
buy_rsi_enabled = CategoricalParameter([True, False], space="buy")
buy_trigger = CategoricalParameter(['bb_lower', 'macd_cross_signal'], space="buy")
```
Above definition says: I have five parameters I want to randomly combine to find the best combination.
@ -262,6 +262,10 @@ Then we have three category variables. First two are either `True` or `False`.
We use these to either enable or disable the ADX and RSI guards.
The last one we call `trigger` and use it to decide which buy trigger we want to use.
!!! Note "Parameter space assignment"
Parameters must either be assigned to a variable named `buy_*` or `sell_*` - or contain `space='buy'` | `space='sell'` to be assigned to a space correctly.
If no parameter is available for a space, you'll receive the error that no space was found when running hyperopt.
So let's write the buy strategy using these values:
```python