Beispiel #1
0
 void OnSerializingMethod(StreamingContext sc)
 {
     Images      = new string[] { Image };
     sLabelColor = LabelColor.ToString();
     sLineColor  = LineColor.ToString();
     FontFamily  = TextFormat.FontFamily.ToString();
     FontStyle   = TextFormat.FontStyle.ToString();
     FontWeight  = TextFormat.FontWeight.ToString();
 }
Beispiel #2
0
        public override JsonCollection BuildParams()
        {
            var options = new JsonCollection(false);

            if (Clickable.HasValue)
            {
                options.Add <bool>("clickable", Clickable.Value);
            }

            if (SuppressInfoWindows.HasValue)
            {
                options.Add <bool>("supressInfoWindows", SuppressInfoWindows.Value);
            }

            options.Add("labelColor", "google.maps.weather.LabelColor." + LabelColor.ToString().ToUpperInvariant(), LabelColor != WeatherLayer.LabelColor.Auto);
            options.Add("temperatureUnits", "google.maps.weather.TemperatureUnit." + TemperatureUnits.ToString().ToUpperInvariant(), TemperatureUnits != WeatherLayer.TemperatureUnit.Default);
            options.Add("windSpeedUnits", "google.maps.weather.WindSpeedUnit." + WindSpeedUnits.ToString().ToUpperInvariant(), WindSpeedUnits != WeatherLayer.WindSpeedUnit.Default);

            return(options);
        }
Beispiel #3
0
        /// <summary>
        /// Generato ad ogni tick, vengono effettuati i calcoli dell'indicatore
        /// </summary>
        /// <param name="index">L'indice della candela in elaborazione</param>
        public override void Calculate(int index)
        {
            // --> Si esce se non ci sono le condizioni per continuare
            if (!ItsOk)
            {
                return;
            }


            Symbol CROSS      = Symbols.GetSymbol(MySymbol);
            Bars   CROSS_Bars = MarketData.GetBars(TimeFrame, CROSS.Name);

            // --> Potrei avere un indice diverso perchè non carico le stesse barre
            int CROSS_Index = CROSS_Bars.GetIndexByDate(Bars.OpenTimes[index]);

            if (CROSS_Index < 0)
            {
                return;
            }

            ExponentialMovingAverage CROSS_ema         = Indicators.ExponentialMovingAverage(CROSS_Bars.ClosePrices, MyEMAPeriod);
            ExponentialMovingAverage Current_CROSS_ema = Indicators.ExponentialMovingAverage(Bars.ClosePrices, MyEMAPeriod);

            double CROSSpips = 0;

            // --> Devo uniformare il numero di pips, i digits saranno di sicuro diversi
            CROSSpips     = CROSS.DigitsToPips(Math.Round(CROSS_Bars.ClosePrices[CROSS_Index] - CROSS_ema.Result[CROSS_Index], CROSS.Digits));
            Result[index] = Math.Round(Current_CROSS_ema.Result[index] + Symbol.PipsToDigits(CROSSpips), Symbol.Digits);

            if (!ShowLabel)
            {
                return;
            }

            string CROSStext = string.Format("  ‹ {0} {1:0.00} ( {2:0.00000} )", CROSS.Name, CROSSpips, CROSS_Bars.ClosePrices[CROSS_Index]);

            if (CanDraw)
            {
                ChartText ThisLabel = Chart.DrawText(CROSS.Name, CROSStext, index, Result[index], Color.FromName(LabelColor.ToString()));
                ThisLabel.VerticalAlignment = VerticalAlignment.Center;
            }
        }