Skip to content

How to change the optimization input parameter range to include decimal values instead of just integers? #934

Answered by ddm-j
LANDERWANG asked this question in Q&A
Discussion options

You must be logged in to vote

The optimizer takes a list or similar type as arguments for the parameters to optimize over.

Therefore you can do something like this:

stats, heatmap = bt.optimize(ATR_Period=range(10, 20, 2), InputMultuplier=list(np.linspace(4, 6, 4)), method='grid', return_heatmap=True)

You can also just type out the list:
InputMultiplier=[4, 4.5, 5, 5.5, 6]

Or use numpy,arange which is similar to range (remember that we need to convert to list):
InputMultiplier=list(np.arange(4, 6, 0.5))

The optimizer may take an np.array type, but I'm not sure.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@kernc
Comment options

kernc Apr 1, 2023
Maintainer

Answer selected by kernc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants