Exemplo n.º 1
0
        void performLong()
        {
            if (_status.longLots > 0)
            {
                _rmLong.Update(_price);

                if (_rmLong.Warning(0.3m))
                {
                    _longLock = true;
                    appendSignal(Actions.CloseLong, 1);
                }
            }

            if ((!_longLock) && (_status.longLots == 0))
            {
                if (_price > _basePrice * (1 + Bar))
                {
                    appendSignal(Actions.OpenLong, 1);
                    _rmLong = new FloatingMonitor(Direction.Long, _price);
                }
            }
        }
Exemplo n.º 2
0
        void performShort()
        {
            if (_status.shortLots > 0)
            {
                _rmShort.Update(_price);

                if (_rmShort.Warning(0.3m))
                {
                    _shortLock = true;
                    appendSignal(Actions.CloseShort, 1);
                }
            }

            if ((!_shortLock) && (_status.shortLots == 0))
            {
                if (_price < _basePrice * (1 - Bar))
                {
                    appendSignal(Actions.OpenShort, 1);
                    _rmShort = new FloatingMonitor(Direction.Short, _price);
                }
            }
        }
Exemplo n.º 3
0
        void holding()
        {
            decimal range = _basePrice * 0.1m / 100;

            if (_status.longLots > 0)
            {
                _rmLong.Update(_price);
                if (_rmLong.Warning(0.5m) ||
                    (_rq.CheckTend(_time.AddSeconds(-45), _time, range, 1.5m) == Direction.Short))
                {
                    appendSignal(Actions.CloseLong, 1);
                }
            }

            if (_status.shortLots > 0)
            {
                _rmShort.Update(_price);
                if (_rmShort.Warning(0.5m) ||
                    (_rq.CheckTend(_time.AddSeconds(-45), _time, range, 1.5m) == Direction.Long))
                {
                    appendSignal(Actions.CloseShort, 1);
                }
            }
        }