I need the date on which highest/lowest has happened?
Then you need to carefully look thru the documentation by that link and find out that there is a bunch of indicators, which not only define the max/min, but the bar at which this happened. Then you need to apply the effort and put together the script which returns you the date you are looking for.
Another way is to pay to somebody to make it for you.
_skipnan (bool, default: False): to skip NaN values when plotting and allowing for example to draw a line between 2 distant points generated by an indicator, which has all intermediate values as NaN (default value for new created data points)
I also set the value, but not take effect.
How to draw a line between 2 distant points ????
@dave78 Sure, no problem with that. I'm usually live trading multiple instruments with few pending orders each on different price levels and it works flawlessly. Same code is used for backtesting - so really no problem at all.
@vladisld Thank you very much. I forgot my password, so I have to register this account to come back online to express my thanks.
And I would like to try this path mentioned in your answer:
"I'm not sure it will work this way out of the box without violating some assumptions inside the Cerebro engine about proper sequence of calls to start,prenext,etc methods to be called as well as proper minperiod handling. However it is probably worth investigating in more details if one is willing to go this path."
for anyone else who stumbles across this thread, since some people are still trying to get this working outside of OP's original branch, wanted to pass along the following info:
you can still get this working if you take the BasicTradeStats analyzer class and import it as a custom analyzer of your own.
Finally, in your code, make sure you have something like the following lines:
# import the file at the top of your code where "BasicTradeStats" is the name of the class
from extensions.analyzers import BasicTradeStats
# add the strategy to cerebro
opt_runs = cerebro.run(maxcpus=1, runonce=False)
for run in opt_runs:
for strategy in run:
# finally, this will print the analyzer
if inner timeperiod is not equal to outer timeperiod, and runonce=False, the got the following excetption:
File "/home/user/.local/lib/python3.7/site-packages/backtrader/lineiterator.py", line 347, in nextstart
File "/home/user/.local/lib/python3.7/site-packages/backtrader/talib.py", line 217, in next
out = self._tafunc(*narrays, **self.p._getkwargs())
File "/home/user/.local/lib/python3.7/site-packages/talib/__init__.py", line 27, in wrapper
return func(*args, **kwargs)
File "talib/_func.pxi", line 3323, in talib._ta_lib.LINEARREG_SLOPE
File "talib/_func.pxi", line 68, in talib._ta_lib.check_begidx1
Exception: inputs are all NaN
@daniel-cunha Add your 1-k indicators to your asset in pandas before loading, then load your close + k indicators together as one data feed. You will then have a data line for each asset that has the 1-k indicators in the same line.