Default indicator scripts

Created at 28 Jan 2019, 20:32
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!
AL

alex_mihail

Joined 09.08.2018

Default indicator scripts
28 Jan 2019, 20:32


Is it possible to find the default scripts for built in indicators as a basis to edit my own versions?


@alex_mihail
Replies

PanagiotisCharalampous
29 Jan 2019, 10:23

Hi Alex,

Source code is not available unfortunately. But the formulas for most of them are publicly available and easily discoverable.

Best Regards,

Panagiotis


@PanagiotisCharalampous

alex_mihail
29 Jan 2019, 15:41

If you made the sources available like TradingView.com it would make it far easier to edit our own custom indicators.

For example you have no option to set RSI or Stochastic RSI source as OHLC/4


@alex_mihail

PanagiotisCharalampous
29 Jan 2019, 15:49 ( Updated at: 21 Dec 2023, 09:21 )

Hi Alex,

You can any indicator as an input to RSI or Stochastic RSI. If you add an indicator on the chart, then it will appear on the Source list. See below

Best Regards,

Panagiotis


@PanagiotisCharalampous

alex_mihail
29 Jan 2019, 16:53

But as you can see there is no option for Open+High+Low+Close divided by 4 for a smoother curve - this is why I need the default script so I can write it in myself. :)


@alex_mihail

PanagiotisCharalampous
29 Jan 2019, 16:58

Hi Alex,

You can write the OHLC/4 indicator and feed it to the RSI. You do not need to develop the RSI from scratch.

Best Regards,

Panagiotis


@PanagiotisCharalampous

alex_mihail
29 Jan 2019, 17:00

RE:

Panagiotis Charalampous said:

Hi Alex,

You can write the OHLC/4 indicator and feed it to the RSI. You do not need to develop the RSI from scratch.

Best Regards,

Panagiotis

Can you show me an example? :)


@alex_mihail

PanagiotisCharalampous
29 Jan 2019, 17:22 ( Updated at: 21 Dec 2023, 09:21 )

Hi Alex,

Here is the indicator

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

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class OHLC4 : Indicator
    {

        [Output("Main")]
        public IndicatorDataSeries Result { get; set; }


        protected override void Initialize()
        {
            // Initialize and create nested indicators
        }

        public override void Calculate(int index)
        {
            // Calculate value at specified index
            Result[index] = (MarketSeries.Open.LastValue + MarketSeries.High.LastValue + MarketSeries.Low.LastValue + MarketSeries.Close.LastValue) / 4;
        }
    }
}

Create it and add it to the chart. Then when you will add RSI, it will show up in the Source list. See below

Best Regards,

Panagiotis


@PanagiotisCharalampous

alex_mihail
29 Jan 2019, 18:13

Very much appreciated Panagiotis :)


@alex_mihail

alex_mihail
30 Jan 2019, 04:10

One last question - how can I add OHLC/4 to Stochastic source?


@alex_mihail

PanagiotisCharalampous
30 Jan 2019, 11:38

Hi Alex,

You cannot add it to Stochastic since Stochastic does not use such type of sources to be calculated. The calculation of Stochastic requires candlestick information. You can find the formula here

Best Regards,

Panagiotis


@PanagiotisCharalampous

alex_mihail
30 Jan 2019, 19:35

RE:

Panagiotis Charalampous said:

Hi Alex,

You cannot add it to Stochastic since Stochastic does not use such type of sources to be calculated. The calculation of Stochastic requires candlestick information. You can find the formula here

Best Regards,

Panagiotis

On TradingView.com it is possible to point Stochastic RSI to OHLC/4 - is there any plans on adding it as a built in indicator?


@alex_mihail

PanagiotisCharalampous
31 Jan 2019, 09:47

Hi Alex,

Stochastc and Stochastic RSI are different indicators, Here is the Stochastic RSI for cTrader. Is takes a hardcoded MarketSeries.Close as input but you can easily tweak it to take it as a parameter and use OHLC/4 instead.

Best Regards,

Panagiotis 


@PanagiotisCharalampous