Ejemplo n.º 1
0
        //static public decimal SavedMoney { get; set; }
        //static public decimal SavedCoins { get; set; }

        public static string CsvRow()
        {
            return(string.Format("{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}, {13}, {14}, {15}, {16}, {17}, {18}",

                                 CandleDate.ToString(CultureInfo.InvariantCulture),
                                 Bid.ToString(CultureInfo.InvariantCulture),

                                 Math.Round(EmaDiff, 4).ToString(CultureInfo.InvariantCulture),
                                 Math.Round(Macd, 4).ToString(CultureInfo.InvariantCulture),
                                 Math.Round(MacdStandard, 4).ToString(CultureInfo.InvariantCulture),
                                 Math.Round(Roc, 4).ToString(CultureInfo.InvariantCulture),
                                 Math.Round(RocSpeed, 4).ToString(CultureInfo.InvariantCulture),

                                 CurrentTrend.ToString(),
                                 CurrentLongTermTrend.ToString(),
                                 SuggestedAction.ToString(),
                                 (Action == TradeAction.Unknown || Action == TradeAction.Hold) ? "" : Action.ToString(),
                                 Indicator,
                                 Motivation,
                                 Note,
                                 Math.Round(TotMoney, 4).ToString(CultureInfo.InvariantCulture),
                                 Math.Round(TotCoins, 4).ToString(CultureInfo.InvariantCulture),
                                 Math.Round(TotValue, 4).ToString(CultureInfo.InvariantCulture),
                                 Math.Round(SellAt, 4).ToString(CultureInfo.InvariantCulture),
                                 Math.Round(BuyAt, 4).ToString(CultureInfo.InvariantCulture)

                                 ));
        }
Ejemplo n.º 2
0
        public AlertResult GetAlertResult()
        {
            var result = new AlertResult();

            try
            {
                result = new AlertResult
                {
                    SuggestionMessage      = GetSuggestionForCurrentSticker(),
                    Success                = true,
                    Symbol                 = CurrentSticker,
                    CurrentRSIValue        = Factory.IndicatorSuggestions.GetRSIIndicator(RsiResults),
                    CurrentChaikinOSCValue = Factory.IndicatorSuggestions.GetChaikinOSCValue(ChaikinOscResults),
                    CurrentPrice           = Math.Round(CurrentQuote.Close, 2)
                };
                var secondSuggestion = CheckForSecondAlert();
                result.SuggestedActions.Add(secondSuggestion.ToString());
                var           indicatorSuggestions = CheckForIndicatorSuggestions();
                List <string> suggestions          = GetStringSuggestions(indicatorSuggestions);
                result.SuggestedActions.AddRange(suggestions);
                FinalSuggestion        = GetFinalSuggestion(indicatorSuggestions, secondSuggestion);
                result.FinalSuggestion = FinalSuggestion.ToString();
            }
            catch (Exception ex)
            {
                result = new AlertResult
                {
                    Success      = false,
                    ErrorMessage = "Failed to get Alert and Suggestion." + ex.Message
                };
            }
            finally
            {
                if (result.Success)
                {
                    SuggestionMgr.SaveSuggestion(result);
                }
            }
            return(result);
        }