Can't get DirectionalMovement working -- different from TradingView/TOS
badger77 last edited by
I'm new to backtrader and am excited but I'm having some issues replicating the Directional Movement Indicator in TradingView inside of the built-in indicators.
For example, you can see here the DI+ and DI- values from Trading view for /ES futures with 5 minute bars on 4/19/2020 at 11:30 PM EDT of DI+: 27.05 and DI-: 14.34.
This is how I've initialized:
self.dm = bt.indicators.DirectionalMovement(period=14)
nextcommand I'm getting values via this syntax
No matter what bar I try, I'm getting values like these:
self.dm.DIminus Out: 98.09214728939715 self.dm.DIplus Out: 0.49034550756342365
I have checked ThinkOrSwim to make sure there isn't an issue with DMI and saw very, very close values for DI+ and DI-, both are using 14 periods and I could confirm at least that ThinkOrSwim was using Wilder's SmoothedMovingAverage.
I've been banging my head against the wall on this, would appreciate any insight.
ab_trader last edited by
show please the script you run and piece of the data. i'll try to run it by myself.