can u provide code for the detrended price oscilator?

11 Oct 2018, 08:11can u provide code for the detrended price oscilator?#1
lec0456posts: 412since: 14 Nov 2012

can u provide code for the detrended price oscilator?

08 Nov 2018, 21:41#2
lec0456posts: 412since: 14 Nov 2012

Can i get an answer please?

09 Nov 2018, 10:54#3
Panagiotis Charalampousposts: 1785since: 13 Jan 2017

Hi lec0456,

Unfortunately we cannot provide source code for built in indicators.

Best Regards,

Panagiotis


Head of Community Management at cTrader
09 Nov 2018, 15:29RE: Detrended Price Indicator#4
Symposiumposts: 12since: 16 Jul 2018
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?

 

09 Nov 2018, 18:07#5
lec0456posts: 412since: 14 Nov 2012

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

 

 

12 Nov 2018, 14:47#6
Panagiotis Charalampousposts: 1785since: 13 Jan 2017

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


Head of Community Management at cTrader