Hope you guys can help me out, been trying to debug this for over a week. Im a pretty newbie in Python. Im trying to test a simple algo using the one Forex pair. 

Im buying when the RSI is below 20 and the currentbar greater than the previousbar on 15 min timeframe. after taking the lesson on trailing stops i have added a trailing stop but i get the following error. My code is pretty messy so any feedback is more than welcome

Runtime Error: AttributeError : 'NoneType' object has no attribute 'Update'
at OnData in main.py:line 51 :: self.stopMarketTicket.Update(updateFields)
AttributeError : 'NoneType' object has no attribute 'Update' (Open Stacktrace)

Author