Hi all;

In the boot camp “Algorithmic Trading Using Python #5 - Trading & Orders” it as the following in OnData()

        if self.stopMarketTicket is not None and self.Portfolio.Invested:
            # move up trailing stop price
            if price > self.highestPrice:
                self.highestPrice = price
                updateFields = UpdateOrderFields()
                updateFields.StopPrice = price * 0.95
                self.stopMarketTicket.Update(updateFields)

But this leaves the question, how often is this then going to be called? Is it every minute during the day, just on open, just on close, maybe every 5th day?

This is leaving it to when OnData() is called to see how tightly the stop loss is tied to the stock price. Which IMHO is not good, I should be deciding how often to do this. I can do it with a datetime member variable to change it less often, but I need to know when OnData will fire to insure that when I do want to recalculate, OnData will shortly be firing.

thanks - dave