Accessing analysers in a strategy
Hi, are there any examples anywhere of using an analyser within a strategy that can reference? I'd like to print analyser results from the stratagys' stop() method when running Cerebro.optstrategy.
There is an attribute holding all analyzers, which you can access via
selfor the strategy instance. At any time.
Thanks for that. I had read that but couldn't quite get to grips with the correct way of accessing an analysers' final value from within the strategy, since the stop method of the analyser needs be called before rets contains any value. eg.
But self.analyzers.mysharpe.stop() only gets called after self.stop()
So I guess my question is: Is there a recommended way to do what I'm trying to do that I have completely missed?
Strategy.stop()is a place where the strategy could still (in theory) do something which affects what an analyzer sees.
For analyzers which calculate things during
nextit's a good point, for analyzers which wait until everything is complete, you will have to fetch it afterwards.