rsi error

Created at 22 Jun 2020, 11:31
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!
LU

luca.tocchi

Joined 25.03.2020

rsi error
22 Jun 2020, 11:31


hi why do you give me wrong values?

thanks

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

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class BBersiwhile : Robot
    {
        [Parameter("Volume (Lots)", Group = "Volume", DefaultValue = 0.1, MinValue = 0.01, Step = 0.01)]
        public double Volume { get; set; }

        [Parameter("Stop Loss", DefaultValue = 10)]
        public double StopLoss { get; set; }

        [Parameter("Take Profit", DefaultValue = 6)]
        public double TakeProfit { get; set; }

        private RelativeStrengthIndex Rsi;

        protected override void OnTick()
        {

            var volumeInUnits = Symbol.QuantityToVolumeInUnits(Volume);
            var EURUSDSeries = MarketData.GetBars(TimeFrame.Minute10);


            Rsi = Indicators.RelativeStrengthIndex(EURUSDSeries.ClosePrices, 14);

            Print("last 1" + Rsi.Result.Last(1));
        }
    }
}


@luca.tocchi
Replies

PanagiotisCharalampous
22 Jun 2020, 11:33

Hi Luca,

It seems correct to me.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

luca.tocchi
22 Jun 2020, 11:35

RE:

PanagiotisCharalampous said:

Hi Luca,

It seems correct to me.

Best Regards,

Panagiotis 

Join us on Telegram

 

the RSI value from the last bar is not 34


@luca.tocchi

PanagiotisCharalampous
22 Jun 2020, 11:50

Hi Luca,

You are not printing the last bar but the bar before. To get the last bar you need to use Last(0).

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

luca.tocchi
22 Jun 2020, 11:51

RE:

PanagiotisCharalampous said:

Hi Luca,

You are not printing the last bar but the bar before. To get the last bar you need to use Last(0).

Best Regards,

Panagiotis 

Join us on Telegram

thanks

 


@luca.tocchi

luca.tocchi
22 Jun 2020, 11:52

RE: RE:

luca.tocchi said:

PanagiotisCharalampous said:

Hi Luca,

You are not printing the last bar but the bar before. To get the last bar you need to use Last(0).

Best Regards,

Panagiotis 

Join us on Telegram

while the value of the penultimate candle is 1?

thanks

 


@luca.tocchi

luca.tocchi
22 Jun 2020, 11:53

RE: RE:

luca.tocchi said:

PanagiotisCharalampous said:

Hi Luca,

You are not printing the last bar but the bar before. To get the last bar you need to use Last(0).

Best Regards,

Panagiotis 

Join us on Telegram

while the value of the penultimate candle is 1?

thanks

 


@luca.tocchi

PanagiotisCharalampous
22 Jun 2020, 11:54

Hi Luca,

Yes correct.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

luca.tocchi
22 Jun 2020, 11:54

RE:

PanagiotisCharalampous said:

Hi Luca,

Yes correct.

Best Regards,

Panagiotis 

Join us on Telegram

thanks! have a nice day


@luca.tocchi