public void OnCurrentValueChanged(DateTime time, double value)
        {
            MaxValue = Math.Max(value, MaxValue);
            if (!AllowHistory)
            {
                return;
            }
            DateTime lastValueTime = DateTime.MinValue;

            if (ValueHistory.Count > 0)
            {
                lastValueTime = ValueHistory.Last().Time;
            }
            if (time - lastValueTime > AggregationTime)
            {
                ValueHistory.Add(new TimeBaseValue()
                {
                    Time = time, Value = value
                });
            }
            DateTime stopLossTime = DateTime.MinValue;

            if (StopLossHistory.Count > 0)
            {
                stopLossTime = StopLossHistory.Last().Time;
            }
            if (time - stopLossTime > AggregationTime)
            {
                StopLossHistory.Add(new TimeBaseValue()
                {
                    Time = time, Value = StopLoss
                });
            }
        }
Exemple #2
0
 public void Reset(System.Random random)
 {
     try
     {
         Capital = CAPITAL_INITIALIZE;
         Deposit.Reset(random);
         ValueHistory.Reset(random);
         ValueHistory.Add(Value);
     }
     catch (System.Exception ex)
     {
         throw ex;
     }
 }