Weighted Compound Oscillator free

by galafrin in category Oscilator at 03/02/2017
Description

This curve is the moving average of weighted sum of four homogenous oscillators , Relative Strength Index , Money Flow Index , Williams Percent Range and Demarker , shaped as MACD. It tends to filter out false signals thus enhancing real ones.

Agressive strategy focuses on slope for instance two adjacent segments of same direction supports higher probabilty the next would follow direction if using fast overall period and higher timeframe.

Moderate strategy focuses on sign of value for direction.

Conservative strategy focuses on level of value for trading.

Weight and period can be adjusted separately for tuning. It has been converted from MT5.

Weighted Compound Oscillator

 

  

Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.
Formula / Source Code
Language: C#
Trading Platform: cAlgocTrader
´╗┐using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo
{
    [Levels ( -20 , 20 ) ]
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None )]
    public class OscWeightOscillator : Indicator
    {
        [Parameter("pscilators period",DefaultValue = 14)]
        public int Period { get; set; }
        
        [Parameter("RSI period",DefaultValue = 14)]
        public int RSIperiod { get; set; }
        [Parameter("RSI weight",DefaultValue = 1)]
        public int RSIweight { get; set; }
        
        [Parameter("MFI period",DefaultValue = 14)]
        public int MFIperiod { get; set; }
        [Parameter("RSI weight",DefaultValue = 1)]
        public int MFIweight { get; set; }
        
        [Parameter("WPR period",DefaultValue = 14)]
        public int WPRperiod { get; set; }
        [Parameter("WPR weight",DefaultValue = 1)]
        public int WPRweight { get; set; }
        
        [Parameter("DeMarker period",DefaultValue = 14)]
        public int DMKperiod { get; set; }
        [Parameter("DeMarker weight",DefaultValue = 1)]
        public int DMKweight { get; set; }
        
        [Parameter("MA period",DefaultValue = 5)]
        public int MAPeriod { get; set; }        
        [Parameter("MA type",DefaultValue = MovingAverageType.Simple )]
        public MovingAverageType maType { get; set; }

        [Output("Main",IsHistogram = true )]
        public IndicatorDataSeries Result { get; set; }

        MoneyFlowIndex MFI;
        RelativeStrengthIndex RSI;
        WilliamsPctR WPR;
        Osc_DeMarker DMK;
        MovingAverage MA;
        IndicatorDataSeries weight;
        
        protected override void Initialize()
        {
        if ( Period > 0 ) 
            {MFIperiod = Period ; RSIperiod = Period ; WPRperiod = Period ; DMKperiod = Period ; MFIweight = 1 ; RSIweight = 1 ; WPRweight = 1 ; DMKweight = 1 ; }
        MFI = Indicators.MoneyFlowIndex ( MFIperiod ) ;
        RSI = Indicators.RelativeStrengthIndex ( MarketSeries.Close , RSIperiod ) ;
        WPR = Indicators.WilliamsPctR ( WPRperiod ) ;
        DMK = Indicators.GetIndicator < Osc_DeMarker > ( DMKperiod ) ;
        weight = CreateDataSeries () ;
        MA = Indicators.MovingAverage ( weight , MAPeriod , maType ) ;
        }

        public override void Calculate(int index)
        {
        weight [ index ] = ( MFIweight * ( MFI.Result [ index ] - 50 ) 
                         +   RSIweight * ( RSI.Result [ index ] - 50 ) 
                         +   WPRweight * ( WPR.Result [ index ] + 100 - 50 ) 
                         +   DMKweight * ( DMK.Result [ index ] * 100 - 50 ) ) / ( MFIweight + RSIweight + WPRweight + DMKweight ) ;
                         
        Result [ index ] = MA.Result [ index ] ;
        }
    }
}
Comments

trend_meanreversion - February 04, 2017 @ 03:59

not sure but you haven't provided "Osc_DeMarker" custom indicator mate . 

galafrin - October 29, 2017 @ 00:44

trend_meanreversion you are right, I downloaded Demarker  https://ctdn.com/algos/indicators/show/411 and renamed it as Osc_Demarker ,  by doing that there is no need to change the code above. 

0