need help

Created at 06 Jun 2022, 12:04
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!
HA

hamijonz

Joined 09.05.2022

need help
06 Jun 2022, 12:04


 

Hi, Thank you in advance

I tried to get the amount of this, but I could not,  
I want to get the exact amount of the RSI when the fractal is struck

 

 


@hamijonz
Replies

amusleh
07 Jun 2022, 09:16

Hi,

Can you post your cBot/Indicator code? so we how you tried to access the value.

Fractal is a lagging indicator, you can't access it's value unless you wait x number of bars based on your provided period value for the indicator.


@amusleh

hamijonz
17 Jun 2022, 20:40 ( Updated at: 21 Dec 2023, 09:22 )

RE:

amusleh said:

Hi,

Can you post your cBot/Indicator code? so we how you tried to access the value.

Fractal is a lagging indicator, you can't access it's value unless you wait x number of bars based on your provided period value for the indicator.

Thanks for the replay
Honestly, I do not have a robot or indicator at the moment to give you the code
But let me try to understand what I mean in another way
Forget the fractal. Please tell me how to find these points(The lowest and highest points)
With what code can I call them?


@hamijonz

amusleh
20 Jun 2022, 09:22 ( Updated at: 20 Jun 2022, 09:23 )

Hi,

You just have to iterate over a data series points with a loop and find the minimum or maximum values.

DateSeries itself has minimum and maximum extension methods: 

Minimum Method - cTrader Automate API

Maximum Method - cTrader Automate API

You can also use a for loop or Linq.


@amusleh

hamijonz
20 Jun 2022, 23:13

amusleh said:

Hi,

You just have to iterate over a data series points with a loop and find the minimum or maximum values.

DateSeries itself has minimum and maximum extension methods: 

Minimum Method - cTrader Automate API

Maximum Method - cTrader Automate API

You can also use a for loop or Linq.

Hi, thank you, but I didn't mean that. I want to get it more precisely
And I don't want to get the maximum of ten previous candlesticks, for example, I just want to get the highest previous and the highest two previous ones
For example, I want to say that if the last value of RSI exceeds the previous highest point, open a buy position.
I hope you understand what I mean


@hamijonz

amusleh
21 Jun 2022, 09:25

RE:

hamijonz said:

amusleh said:

Hi,

You just have to iterate over a data series points with a loop and find the minimum or maximum values.

DateSeries itself has minimum and maximum extension methods: 

Minimum Method - cTrader Automate API

Maximum Method - cTrader Automate API

You can also use a for loop or Linq.

Hi, thank you, but I didn't mean that. I want to get it more precisely
And I don't want to get the maximum of ten previous candlesticks, for example, I just want to get the highest previous and the highest two previous ones
For example, I want to say that if the last value of RSI exceeds the previous highest point, open a buy position.
I hope you understand what I mean

Hi,

You can use the DataSeries Maximum / Minimum methods for that, just use Maximum to find the highest value of RSI on x previous bars, then compare it with current RSI value.

 


@amusleh

paolo.panicali
28 Jul 2022, 16:15 ( Updated at: 21 Dec 2023, 09:22 )

Rsi Breakout Indicator for Renko

Hello not sure if this is what you wanted to do... Plots Rsi tops > of all the previous tops for N bars and in a certain range of RSI (exapmple RSI >=60 and RSI<=90)

For the bottoms just do the opposite...

it seems it also works for other timeframes...

// Rsi Breakout for Renko by paolo panicali 2022
// answer to hamijonzsince: 09 May 2022  06 Jun 2022, 12:11

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

namespace cAlgo
{
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class RenkoRsictrader : Indicator
    {
        [Parameter("Period", Group = "RSI", DefaultValue = 14)]
        public int RsiPeriod { get; set; }

        [Parameter("Rsi Min Value", Group = "RSI", DefaultValue = 60)]
        public int RsiMin { get; set; }

        [Parameter("Rsi Max Value", Group = "RSI", DefaultValue = 100)]
        public int RsiMax { get; set; }

        [Output("Breakout Top Signal", Color = Colors.Aqua, Thickness = 5, PlotType = PlotType.Points)]
        public IndicatorDataSeries BreakOutTop { get; set; }

        [Output("RSI", Color = Colors.Red, Thickness = 1, PlotType = PlotType.DiscontinuousLine)]
        public IndicatorDataSeries Rsi_Value { get; set; }

        RelativeStrengthIndex RSI;
        double prevRsi_Value, TopRsi_Value, LastRsi_Value;
        int LookBack;

        IndicatorDataSeries RelativeTop_Value_Series, RelativeTop_Top_Series;

        protected override void Initialize()
        {
            RSI = Indicators.RelativeStrengthIndex(Bars.ClosePrices, RsiPeriod);

            RelativeTop_Value_Series = CreateDataSeries();
            RelativeTop_Top_Series = CreateDataSeries();

            LookBack = 24;
        }

        public override void Calculate(int index)
        {

            Rsi_Value[index] = RSI.Result[index];

            prevRsi_Value = RSI.Result[index - 2];
            TopRsi_Value = RSI.Result[index - 1];
            LastRsi_Value = RSI.Result[index];

            if (TopRsi_Value > prevRsi_Value && TopRsi_Value > LastRsi_Value)
            {
                RelativeTop_Top_Series[index - 1] = 1;
                RelativeTop_Value_Series[index - 1] = TopRsi_Value;
            }
            else
            {
                RelativeTop_Top_Series[index - 1] = 0;
            }


            if (RelativeTop_Top_Series[index - 1] == 1 && RelativeTop_Value_Series[index - 1] >= RsiMin && RelativeTop_Value_Series[index - 1] <= RsiMax)
            {
                bool IsBreakout = true;

                for (int i = 2; i <= 2 + LookBack; i++)
                {
                    if (RelativeTop_Top_Series[index - i] == 1 && RelativeTop_Value_Series[index - i] > RelativeTop_Value_Series[index - 1])
                    {
                        IsBreakout = false;
                        break;
                    }
                }

                if (IsBreakout)
                {
                    BreakOutTop[index - 1] = TopRsi_Value;
                }
                else
                {
                    //BreakOutTop[index - 1] = 0;
                }
            }
        }
    }
}

 

Hope it ll help, bye.


@paolo.panicali