Skip to content

Extra column included in data for the indicator values - how to plot on candle stick chart? #764

Answered by kernc
CadeHalcyon asked this question in Q&A
Discussion options

You must be logged in to vote

In the standard examples using SMAs, they are plotted as lines on the candle stick chart.

If you see the examples, the SMAs are wrapped in self.I() calls. If you further see the reference docs for Strategy.I(), it says:

If plot= is True, the indicator is plotted ...

Therefore, you can plot your custom indicators with:

class MyS(Strategy):
    def __init__(self):
        self.I(lambda: self.data.my_indicator)

You need to wrap it behind a function simply because this is what Strategy.I() takes.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@CadeHalcyon
Comment options

Answer selected by CadeHalcyon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants