Replies

fringou.bfe
21 Nov 2018, 16:30

i want to change the color of the line, in red if it down and green if it up


@fringou.bfe

fringou.bfe
21 Nov 2018, 15:57

another problem

i change the code, but why i have 2 line now and i would like just 1? thanks for help

using System;
using cAlgo.API;
using cAlgo.API.Indicators;

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true, AccessRights = AccessRights.None)]
    public class HMA : Indicator
    {
        [Output("HMAup", Color = Colors.Green)]
        public IndicatorDataSeries hmaup { get; set; }
        [Output("HMAdown", Color = Colors.Red)]
        public IndicatorDataSeries hmadown { get; set; }

        [Parameter(DefaultValue = 21)]
        public int Period { get; set; }

        private IndicatorDataSeries diff;
        private WeightedMovingAverage wma1;
        private WeightedMovingAverage wma2;
        private WeightedMovingAverage wma3;


        protected override void Initialize()
        {
            diff = CreateDataSeries();
            wma1 = Indicators.WeightedMovingAverage(MarketSeries.Close, (int)Period / 2);
            wma2 = Indicators.WeightedMovingAverage(MarketSeries.Close, Period);
            wma3 = Indicators.WeightedMovingAverage(diff, (int)Math.Sqrt(Period));
        }

        public override void Calculate(int index)
        {
            double var1 = 2 * wma1.Result[index];
            double var2 = wma2.Result[index];

            diff[index] = var1 - var2;



            if (wma3.Result[index] > wma3.Result[index - 1])
            {
                hmaup[index] = wma3.Result[index];
            }

            if (wma3.Result[index] < wma3.Result[index - 1])
            {
                hmadown[index] = wma3.Result[index];
            }


        }
    }
}

 


@fringou.bfe

fringou.bfe
19 Nov 2018, 14:30

un grand merci

je te remercie, ca marche nikel :)


@fringou.bfe

fringou.bfe
19 Nov 2018, 14:28

problème résolue dans un autre post

mon probleme est resolu dans un autre poqst, merci


@fringou.bfe