-
Hi there, I am testing an indicator from
When I print
But when I print self.dir values I always get the same value which is not reflecting the current state next method is running.
I appreciate for any kind of help. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 5 replies
-
I'm sorry that I don't have time to analyse you code but with just a look I see that in the indicator assignment line: |
Beta Was this translation helpful? Give feedback.
-
Thanks to @AGG2017 I solved the issue I was having about returning and operating on dataframe. But there is another issue I am having about warming up period. The indicator I am importing returns values including NaN which is ok for me. Is there a way to disable warming up period? Because of this warming up period my results are returning wrong trades. So, based on these values next() method is called with 19th record whereas I want to make it start with 1st record. Thanks
|
Beta Was this translation helpful? Give feedback.
-
Unfortunately there is no way to disable it. It always skip all first nan rows so you have to add more history data at the beginning. We have to wait the version where we can select start and end date-time for the backtesting. It can help to force the start and end at specific range. I did it for myself with many other changes for backtesting options so I know how helpful it is. |
Beta Was this translation helpful? Give feedback.
-
@flexelem As @AGG2017 said, if you modify: ...
self.dir = self.I(lambda: self.spt_df.iloc[:, 1]) then @AGG2017 Instead of |
Beta Was this translation helpful? Give feedback.
-
@kernc Yes, you are right. It's better to use
We often need to optimize the parameters of the indicators and for this reason they need to be calculated inside |
Beta Was this translation helpful? Give feedback.
@flexelem As @AGG2017 said, if you modify:
then
self.dir[-1]
innext()
will work as you expect. Callingself.I()
wraps the values into an indicator type that can be length-managed iteration-wise.@AGG2017 Instead of
self._broker._i
I'd recommendi = len(self.data)
or similar. This interface is public whereas_broker
is not.