Imagine, we want to optimize strategy - find best hours to open and close trade.
So we define hours ranges and run optimizer:
open_hour = range(1, 18) close_hour = range(12, 23) back_trader.optstrategy(MorningBuy, open_hour=open_hour, close_hour=close_hour, silent=True)
How to avoid wrong ranges like "close hour 16 is greater than open_hour 18"? I could check that in strategy's
__init__, but how to stop strategy running then?
You can stop the entire system with
cerebro.runstop, but stopping a
Strategywas not an expected operation.
Of course in the course of an optimization and with that use case in mind, the clock time don't make sense, it may seem sensible to skip going over the entire data set for some strategies.
There is commit in the
developmentbranch which adds the first in the (potentially more to come) family of Exceptions that may get added to the platform.
Added to the documents:
Still in early infancy, but you may want to give it a try
Exception is exactly what I need if it don't interrupt whole optimization process.
When do you plan to move it into master?
Resampling is being looked into for remaining rough details ...