Exemplo n.º 1
0
 public bool Equals(WeightedPosition obj)
 {
     if (ReferenceEquals(null, obj))
     {
         return(false);
     }
     if (ReferenceEquals(this, obj))
     {
         return(true);
     }
     return(Equals(obj.p, p) && obj.weight == weight);
 }
Exemplo n.º 2
0
 public void addMaybe(WeightedPosition position, double pnl)
 {
     if (!includes(position, pnl))
     {
         consecutive = 0;
         return;
     }
     positions.Add(position);
     maxPnl_  = Math.Max(pnl, maxPnl_);
     minPnl_  = Math.Min(pnl, minPnl_);
     sumPnl_ += pnl;
     consecutive++;
     maxConsecutive_ = Math.Max(consecutive, maxConsecutive_);
     totalBarsHeld_ += position.barsHeld();
 }
Exemplo n.º 3
0
        public void addOrder(WeightedPosition position, WeightedTrade trade)
        {
            currentTrades.Add(trade);
            if (position.isEntry(trade))
            {
                open++; return;
            }
            if (!position.isClosed())
            {
                return;
            }
            var profit = position.pnl(true, arguments.runInNativeCurrency);

            each(trackers.Values, tracker => tracker.addMaybe(position, profit));
            open--;
        }