Пример #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);
                }
            }
        }
Пример #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);
                }
            }
        }
Пример #3
0
        void analyse()
        {
            decimal range = _basePrice * 0.15m / 100;
            decimal ratio = _rq.GetTotalVol(_time.AddSeconds(-60), _time) / (_baseVol / 14400 * 60m);

            if (ratio > 3m)
            {
                if (_status.longLots == 0)
                {
                    if (_price > _basePrice)
                    {
                        if (tend(range, 3m) == Direction.Long)
                        {
                            if (checkPos(Direction.Long, ratio))
                            {
                                appendSignal(Actions.OpenLong, 1);
                                _rmLong = new FloatingMonitor(Direction.Long, _price);
                            }
                        }
                    }
                }

                if (_status.shortLots == 0)
                {
                    if (_price < _basePrice)
                    {
                        if (tend(range, 3m) == Direction.Short)
                        {
                            if (checkPos(Direction.Short, ratio))
                            {
                                appendSignal(Actions.OpenShort, 1);
                                _rmShort = new FloatingMonitor(Direction.Short, _price);
                            }
                        }
                    }
                }
            }
        }