← Zurück

Преобразование переменных

Вопрос вот в чем RelativeStrengthIndex на выходе дает переменную типа IIndicatorValue (с, как бы, числовым значением 32.7533....82) а мне нужно преобразовать ее в int, dooble, или decimal. Мне нужна цифра,чтобы работать с ней. Подскажите, каким образом это делается? Вылетает ошибка преобразования. Привожу код:

public void MarkerRSI()
        {
            if (Options.ProgressBarValue != null)
            {
                
                decimal ProcentValue = Options.ProgressBarValue.To<Decimal>();
                Console.WriteLine(ProcentValue);
                //var ProcentBar = (267*ProcentValue)/100;
                // int PixelWeight = (int)ProcentBar;
            }
        }
    }

    public static class Options
    {
        public static int Item { get; set; }
        public static IIndicatorValue ProgressBarValue {get; set;}

    }
//запускаем индикатор RSI
            rsi.Process(candle.ClosePrice);
            if (rsi.IsFormed == true)
            {
                Options.ProgressBarValue = rsi.Process(candle.ClosePrice);

            }
            
        }
        //создаем индикатор RSI
        public RelativeStrengthIndex rsi = new RelativeStrengthIndex() { Length = 10 };
    }

War dieses Thema hilfreich?

Thema teilen

Kommentare (1)

Anmelden oder Konto erstellen, Melden Sie sich an oder registrieren Sie sich, um einen Kommentar zu hinterlassen