Ошибка при установке StopLoss в процентах
							
							
						 
						
						
						
						
	
			Приветствую,
При переходе с 4.1.8 на 4.1.19 обнаружил, что StopLossStrategy стала генерировать следующее исключение:
Code
2013/11/18 09:30:19.290|Error  |SLS_RIZ3@FORTS_XXXXXXX|System.ArgumentException: Невозможно привести процентное значение в абсолютное.
Parameter name: unit
   at StockSharp.BusinessEntities.Unit.op_Explicit(Unit unit)
   at StockSharp.Algo.Strategies.StopLossStrategy.get_ActivationPrice()
   at StockSharp.Algo.Strategies.ProtectiveStrategy.NeedQuoting(Decimal currentPrice, Decimal currentVolume, Range`1 acceptablePriceRange, Decimal newVolume)
   at StockSharp.Algo.Strategies.QuotingStrategy.ProcessQuoting()
   at StockSharp.Algo.Strategies.QuotingStrategy.SyncProcessQuoting()
   at StockSharp.Algo.Strategies.QuotingStrategy.OnStarted()
   at StockSharp.Algo.Strategies.ProtectiveStrategy.OnStarted()
   at StockSharp.Algo.Strategies.Strategy.#=qtKQ9VNIVpLP1g1BUAZxdTGU5EYfMco3AM7uGI5mgJio=(ProcessStates #=qEConwVuDh98j4XAFNYit9w==)
 В старых версиях StockSharp для расчета ActivationPrice использовалось следующее выражение:
Code
    var activationPrice = (decimal)(isBuy ? (decimal)_prevPrice - ProtectiveLevel : (decimal)_prevPrice + ProtectiveLevel);
 При вычислении выражения типы операндов неявно приводились к Unit и затем результат приводился к decimal. Все работало.
В новой версии судя по всему ProtectiveLevel явно приводится к decimal. В результате получаем исключение. Декомпилированный кусочек кода:
Code
Decimal num1 = this.ProtectiveLevel.Type == UnitTypes.Limit ? MathHelper.Abs(this.BasePrice - (Decimal) this.ProtectiveLevel) : (Decimal)this.ProtectiveLevel;
 Есть ли ошибка в версии 4.2.1 - еще не проверял.