In a LEAN QCAlgorithm, I can request a trade and emit an Insight with either self.SetHoldings() or self.EmitInsights().

In the former method, trades are executed immediately as specified, such that I can monitor the precise points for market entry / exits and position a strategy accordingly.

However, in the latter method, trades are closed after the duration expires, such that they'll often close too soon or too late -- particularly when thinking about a market in terms of volume-bars, dollar-bars, or price-bars rather than time-bars.

Should a strategy first submit a worst-case duration in an insight, then emit a follow-up InsightDirection.Flat at a minimum timedelta duration to try to close out a position at the right time? Or, is it appropriate to use self.SetHoldings?

Author