For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

Plotting a LinesOperationObject



  • Apologies if this has been mentioned in the docs (I couldn't find it), but how do I plot a LinesOperation object that I create within a strategy? For instance, I created a zscore object using two other lines, and I want to plot it. This is what I tried:

    self.zscore = self.spread / self.stdev
    self.zscore.plotinfo.plot = True
    

    where self.spread and self.stdev are two lines created previously.

    I get the following error: AttributeError: 'LinesOperation' object has no attribute 'plotinfo'.



  • The end of this might help.



  • exactly same question



  • So far it needs to create a new indicator for zscore and plot it



  • Firstly: "lines objects from operations DO NOT GET plotted (like close_over_sma = self.data.close > self.sma)"
    Second: "There is an auxiliary LinePlotterIndicator which plots such operations if wished with the following approach:"
    And the example:

    close_over_sma = self.data.close > self.sma
    LinePlotterIndicator(close_over_sma, name='Close_over_SMA')
    
    enjoy:)

Log in to reply
 

});