Esempio n. 1
0
        public override void GotFill(TradeLink.API.Trade fill)
        {
            // keep track of position
            D(fill.symbol + " fill: " + fill.ToString());
            _pt.Adjust(fill);
            // ensure fill comes from this response
            int idx = _entrysignal.getindex(fill.symbol);

            if (idx < 0)
            {
                return;
            }
            // reset signals if we're flat (allows re-entry)
            if (_pt[fill.symbol].isFlat)
            {
                _entrysignal[fill.symbol] = false;
                _exitsignal[fill.symbol]  = false;
            }
        }
        public override void GotFill(TradeLink.API.Trade fill)
        {
            // keep track of position
            D(fill.symbol + " fill: " + fill.ToString());
            track_positions.Adjust(fill);

            // ensure fill comes from this response
            int idx = track_symbols.getindex(fill.symbol);  // dimon: imho this is ugly (error prone) method. What if 2 strategies working with same symbol simultaneously? it all will go to hell..

            if (idx < 0)
            {
                return;
            }
            // reset signals if we're flat (allows re-entry)
            if (track_positions[fill.symbol].isFlat)
            {
                track_symbols[fill.symbol]     = false;
                track_exitsignals[fill.symbol] = false;
            }
        }