For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
Crossover doesn't working with prices which move in small decimal differences.
-
class SlowFastEmaCrossOverStrategy(bt.Strategy): def __init__(self): self.fast_ema = bt.indicators.EMA(self.data.close, period=self.params.fast_ema) self.slow_ema = bt.indicators.EMA(self.data.close, period=self.params.slow_ema) # This doesn't work if prices move in decimal differences, its always returns 0 self.signal = bt.ind.CrossOver(self.fast_ema, self.slow_ema) self.sma = bt.indicators.SMA(self.datas[0].close, period=200)
The above code doesn't give crossover signal as the difference in prices movements is in decimal for example XRP moves between 0.7 to 0.8, it has something to do with NonZeroDifference indicator. Can anybody help how can I get it working with this?
-
@Sumeet-Badiger after you load the data, just multiply the entire series by 1000 and then does it work?