Hello!
I am having a problem when trying to use the "Trail Stop" function below. It seems like I am not able to check if a Forex trade is long or short to update the stop loss accrodingly. When I run it with my algorithm, I get the runtime error: 'ForexHolding' object has no attribute 'Islong'. When I read the documentation I see that "IsLong" and "IsShort" are both members of ForexHolding. (Added the link below).
Documentation link: https://www.quantconnect.com/lean/documentation/topic27441.html
This is the line I use to pass the values to the function:
if self.Portfolio.Invested:
self.TrailingStop(base_SL, self.Portfolio[self.symb])
Where "base_SL" is a calculation of X amount of pips from current price. "self.sym" is a string with a forex pair (ex: EURUSD)
Am I doing something wrong with my implementation? Do I need to reference the order instead of the pair somehow? Is there another way I can check if my forex trade is long or short?
Thank you in advance for the help!
Pablo