I\'m having trouble getting this pine script code converted to Python. It detects what the last signal was (long or short). I\'m trying to get it to work with Backtrader. Any