can u provide code for the detrended price oscilator?

Created at 11 Oct 2018, 08:11
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!
lec0456's avatar

lec0456

Joined 14.11.2012

can u provide code for the detrended price oscilator?
11 Oct 2018, 08:11


can u provide code for the detrended price oscilator?


@lec0456
Replies

lec0456
08 Nov 2018, 21:41

Can i get an answer please?


@lec0456

PanagiotisCharalampous
09 Nov 2018, 10:54

Hi lec0456,

Unfortunately we cannot provide source code for built in indicators.

Best Regards,

Panagiotis


@PanagiotisCharalampous

Symposium
09 Nov 2018, 15:29

RE: Detrended Price Indicator
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 DetrendedPriceIndicator : Indicator
    {
        [Parameter()]
        public DataSeries Source { get; set; }

        [Parameter("Period", DefaultValue = 14.0)]
        public int Period { get; set; }

        [Parameter("DPO MA Type", DefaultValue = MovingAverageType.Simple)]
        public MovingAverageType MaType { get; set; }

        [Parameter("Display Current Trend", DefaultValue = true)]
        public bool IncludeSignal { get; set; }

        [Output("DPO Fast", PlotType = PlotType.DiscontinuousLine, Color = Colors.White, Thickness = 1)]
        public IndicatorDataSeries DPO { get; set; }

        [Output("Focus Level", PlotType = PlotType.DiscontinuousLine, Color = Colors.Gray, LineStyle = LineStyle.Lines, Thickness = 1)]
        public IndicatorDataSeries Focus { get; set; }

        public API.Indicators.DetrendedPriceOscillator dpo { get; set; }

        public bool IsBuy { get; set; }
        public bool IsSell { get; set; }

        private string _trend = string.Empty;
        private Colors trendColor = Colors.Red;

        protected override void Initialize()
        {
            dpo = Indicators.DetrendedPriceOscillator(Source, Period, MaType);
        }
        public override void Calculate(int index)
        {
            DPO[index] = dpo.Result[index];

            Focus[index] = 0;
            {
                if (index < 0.1)
                    return;

                DPO[index] = dpo.Result[index];

                // if bearish
                if (dpo.Result.LastValue < 0)
                {
                    // if the trigger for a bearish signal has not occurred
                    if (!IsSell)
                    {
                        // Sell Signal
                        IsBuy = false;
                        IsSell = true;

                        _trend = "Current Trend Signal   |   SELLING";
                        trendColor = Colors.Red;

                        if (IsLastBar)
                        {

                        }
                    }
                }

                // if bullish
                if (dpo.Result.LastValue > 0)
                {
                    if (!IsBuy)
                    {
                        // Buy Signal
                        IsBuy = true;
                        IsSell = false;

                        _trend = "Current Trend Signal   |   BUYING";
                        trendColor = Colors.Lime;

                        if (IsLastBar)
                        {

                        }
                    }
                }

                if (IncludeSignal)

                    ChartObjects.DrawText("trendText", _trend, StaticPosition.TopLeft, trendColor);
                {

                }
            }
        }
    }
}

lec0456 said:

Can i get an answer please?

 


@Symposium

lec0456
09 Nov 2018, 18:07

Panagiotis,

I am not sure why this is the policy at Spotware. For Indicators that are not proprietary, the code should be open-source. Verifying the calculations are important and customizing them is a benefit for traders.

Spotware used to provide the code for indicators, why has this changed and how does this benefit the business? Spotware gains nothing by hiding the code. Traders who are putting their money on the line should be able to see the calculations there trades are being based on.

 

Please raise these concerns to management and see if this is the something that can be changed.

 

Thanks,

Louis

 

 


@lec0456

PanagiotisCharalampous
12 Nov 2018, 14:47

Hi lec0456,

The calculation of some indicators might be public domain knowledge but the source code for each indicator implementation is proprietary work of Spotware. If you wish to verify the results of an indicator, there are many ways to do so without having access to the source code. 

Best Regards,

Panagiotis


@PanagiotisCharalampous