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

How to: Have "SPY" based indicator for every symbol execution



  • Hello all,
    I"m new to backtrader, I"m writing my first serious strategy and I want to correlate
    the current data to SMA("SPY"),
    for example, divide current close with current SMA("SPY") read in my strategy.
    Semathically something like this:
    buy1 = self.data.close[0] / indicators.SMA("SPY")[0]

    The "SPY" part should be static no matter which symbol I"m currently working.
    Ultimately I want to compare my symbol to the leading trend.

    Thank you.



  • Since no one answered I would guess Backtrader has no support for such a scenario?



  • No answer simply means no answer. Your scenario is possible with bt.


Log in to reply
 

});