18 using System.Collections.Generic;
29 private readonly decimal _maximumUnrealizedProfitPercent;
37 decimal maximumUnrealizedProfitPercent = 0.05m
40 _maximumUnrealizedProfitPercent = Math.Abs(maximumUnrealizedProfitPercent);
50 foreach (var kvp
in algorithm.Securities)
52 var security = kvp.Value;
54 if (!security.Invested)
59 var pnl = security.Holdings.UnrealizedProfitPercent;
60 if (pnl > _maximumUnrealizedProfitPercent)
62 var symbol = security.Symbol;
65 algorithm.Insights.Cancel(
new[] { symbol });