rsi multi RSI 3tim

Created at 08 Aug 2015, 10:05
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
ON

oneplusoc

Joined 09.03.2015

rsi multi RSI 3tim
08 Aug 2015, 10:05


Hii all Anyone have any ideas what I'm doing wrong

thanks

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

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = false,  TimeZone = TimeZones.UTC)]
    public class multirsi3tim : Indicator
    {
        [Parameter(DefaultValue = 14)]
        public int Period { get; set; }

        [Output("rsi", Color = Colors.Yellow)]
        public IndicatorDataSeriesrsi{ get; set; }

        [Output("rsi5", Color = Colors.Orange)]
        public IndicatorDataSeries rsi5 { get; set; }

        [Output("rsi10", Color = Colors.Red)]
        public IndicatorDataSeries rsi10 { get; set; }

        private MarketSeries series5;
        private MarketSeries series10;

        private RelativeStrengthIndex rsi;
        private RelativeStrengthIndex rsi5;
        private RelativeStrengthIndex rsi10;

        protected override void Initialize()
        {
            series5 = MarketData.GetSeries(TimeFrame.Minute5);
            series10 = MarketData.GetSeries(TimeFrame.Minute10);

            rsi = Indicators.RelativeStrengthIndex(MarketSeries.Close, Period,RelativeStrengthIndexType.Triangular);
            rsi5 = Indicators.RelativeStrengthIndex(series5.Close, Period, RelativeStrengthIndexType.Triangular);
            rsi10 = Indicators.RelativeStrengthIndex(series10.Close, Period, RelativeStrengthIndexType.Triangular);
        }

        public override void Calculate(int index)
        {
            rsi[index] = rsi.Result[index];

            var index5 = GetIndexByDate(series5, MarketSeries.OpenTime[index]);
            if (index5 != -1)
                rsi5[index] = rsi5.Result[index5];

            var index10 = GetIndexByDate(series10, MarketSeries.OpenTime[index]);
            if (index10 != -1)
                rsi10[index] = rsi10.Result[index10];
        }


        private int GetIndexByDate(MarketSeries series, DateTime time)
        {
            for (int i = series.Close.Count - 1; i > 0; i--)
            {
                if (time == series.OpenTime[i])
                    return i;
            }
            return -1;
        }
    }
}

 

 


@oneplusoc
Replies

Spotware
17 Aug 2015, 19:30

Dear Trader,

We do not provide coding assistance services. We more than glad to assist you with specific questions about cAlgo.API. You also can contact one of our Partners or post a job in Development Jobs section for further coding assistance.


@Spotware

ClickAlgo
19 Aug 2015, 18:58

take a close look at your user defined parameters, can you see the problem?


@ClickAlgo