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 get the indicators values?
-
class SmaCross(bt.SignalStrategy):
def init(self):
sma1, sma2 = bt.ind.SMA(period=10), bt.ind.SMA(period=30)
crossover = bt.ind.CrossOver(sma1, sma2)
self.signal_add(bt.SIGNAL_LONG, crossover)How can I get the value of sma1 from your example?
-
In order to get indicator values you will need to re-write the code to have self.sma1 and self.sma2 variables. Then get them in the next as all other variables.
-
@terrence-chen said in How to get the indicators values?:
How can I get the value of sma1 from your example?
Take some advice: learn to program and learn Python before you do algotrading.