Example #1
0
        /// <summary>
        /// start alert
        /// запустить оповещение
        /// </summary>
        private void SignalAlarm()
        {
            if (IsMusicOn)
            {
                UnmanagedMemoryStream stream = Resources.Bird;

                if (Music == AlertMusic.Duck)
                {
                    stream = Resources.Duck;
                }
                if (Music == AlertMusic.Wolf)
                {
                    stream = Resources.wolf01;
                }
                AlertMessageManager.ThrowAlert(stream, Name, Message);
            }

            if (IsMessageOn)
            {
                SetMessage();
            }

            IsOn = false;
            Save();
        }
Example #2
0
        public AlertSignal CheckSignal(List <Candle> candles)
        {
            if (IsOn == false || candles == null)
            {
                return(null);
            }

            // 3 run along allert lines and check triggering
            // 3 бежим по линиям аллерта и проверяем срабатывание

            if (TypeActivation == PriceAlertTypeActivation.PriceLowerOrEqual &&
                candles[candles.Count - 1].Close <= PriceActivation ||
                TypeActivation == PriceAlertTypeActivation.PriceHigherOrEqual &&
                candles[candles.Count - 1].Close >= PriceActivation)
            {
                IsOn = false;
                if (MessageIsOn)
                {
                    UnmanagedMemoryStream stream = Resources.Bird;

                    if (MusicType == AlertMusic.Duck)
                    {
                        stream = Resources.Duck;
                    }
                    if (MusicType == AlertMusic.Wolf)
                    {
                        stream = Resources.wolf01;
                    }

                    AlertMessageManager.ThrowAlert(stream, Name, Message);
                }
                if (SignalType != SignalType.None)
                {
                    return(new AlertSignal {
                        SignalType = SignalType, Volume = VolumeReaction, NumberClosingPosition = NumberClosePosition, PriceType = OrderPriceType, Slipage = Slippage
                    });
                }
                if (SignalType == SignalType.None)
                {
                    return(new AlertSignal());
                }
            }

            return(null);
        }