trying to do a max drawdown per trade of 2 %

Runtime Error: AttributeError : 'Forex' object has no attribute 'TotalUnrealizedProfit'
at OnData
if self.Securities["AUDNZD"].TotalUnrealizedProfit <= -.02*(self.Portfolio.Cash + self.Portfolio.TotoalUnrealisedProfit + self.Portfolio.TotalUnleveredAbsoluteHoldingsCost):
===
at Python.Runtime.PyObject.Invoke (Python.Runtime.PyTuple args in main.py:line 46
AttributeError : 'Forex' object has no attribute 'TotalUnrealizedProfit'

 

if self.Portfolio.Invested: if self.Securities["AUDNZD"].TotalUnrealizedProfit <= -.02*(self.Portfolio.Cash + self.Portfolio.TotoalUnrealisedProfit + self.Portfolio.TotalUnleveredAbsoluteHoldingsCost): self.SetHoldings("AUDNZD", .0001)

trying to set a max drawdown per trade of 2 % total capital

Author