Hello all,

I am trying to figure out how to initiate a StopLossOrder in Python. 

Here is the code that I have. I'm not sure if I even have the format correct:

# Use 100% of the portfolio to buy XIV. self.SetHoldings(self.xiv, 1) # Get the current price of XIV which should be equal to the price that XIV was bought. StopPrice = self.Securities['XIV'].Price # Sell all of the XIV holdings if the price drops below StopPrice self.StopMarketOrder(self.xiv, 0, StopPrice, StopPrice)

Once again, I'm sure that this format is completely wrong, but I can't find a simple "black and white" example.

The end goal of the above code is to buy XIV with all of the portfolio. If the price drops a percentage below what the purchase price was, sell all holdings in XIV.

Thanks in advance

Author