CoVariance indicator free

by mfejza in category Oscilator at 09/01/2023
Description

CoVariance function as indicator to interpret trade sentiment zones

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.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace cAlgo
{
    [Levels(0)]
    [Cloud("ZoneUp", "ZoneDn", FirstColor = "Red", SecondColor = "Green", Opacity = 0.2)]  
    [Indicator(IsOverlay = false, AccessRights = AccessRights.None)]
    public class mCoVariance : Indicator
    {
        [Parameter("Fast Period (8)", DefaultValue = 8)]
        public int inpPeriodFast { get; set; }
        [Parameter("Slow Period (16)", DefaultValue = 16)]
        public int inpPeriodSlow { get; set; }
        [Parameter("Bands Period (8)", DefaultValue = 8)]
        public int inpPeriodBands { get; set; }
        [Parameter("Bands Deviation (1.382)", DefaultValue = 0.764)]
        public double inpDeviationBands { get; set; }

        [Output("CoVariance", IsHistogram = false, LineColor = "Black", PlotType = PlotType.Line, LineStyle = LineStyle.Solid, Thickness = 1)]
        public IndicatorDataSeries outCoVariance { get; set; }
        [Output("Top", LineColor = "CadetBlue", PlotType = PlotType.Line, Thickness = 1)]
        public IndicatorDataSeries outBBup { get; set; }
        [Output("Down", LineColor = "CadetBlue", PlotType = PlotType.Line, Thickness = 1)]
        public IndicatorDataSeries outBBdn { get; set; }
        [Output("ZoneUp", LineColor = "Transparent")]
        public IndicatorDataSeries outZoneUp { get; set; }
        [Output("ZoneDn", LineColor = "Transparent")]
        public IndicatorDataSeries outZoneDn { get; set; }
        
        private MovingAverage _mafast, _maslow, _maweight;
        private IndicatorDataSeries _rawprice, _covariance;
        private BollingerBands _bb;
        

        protected override void Initialize()
        {
            _mafast = Indicators.MovingAverage(Bars.ClosePrices, inpPeriodFast,  MovingAverageType.Simple);
            _maslow = Indicators.MovingAverage(Bars.ClosePrices, inpPeriodSlow,  MovingAverageType.Simple);
            _maweight = Indicators.MovingAverage(Bars.ClosePrices, inpPeriodSlow,  MovingAverageType.Weighted);
            _covariance = CreateDataSeries();
            _rawprice = CreateDataSeries();
            _bb = Indicators.BollingerBands(_covariance, inpPeriodBands, inpDeviationBands, MovingAverageType.Simple);
        }

        public override void Calculate(int i)
        {
            _rawprice[i] = Bars.ClosePrices[i] * Bars.ClosePrices[i];
            _covariance[i] = 0.1 * (_maweight.Result[i] - _mafast.Result[i] * _maslow.Result[i]);
            
            outCoVariance[i] = _covariance[i];
            outBBup[i] = _bb.Top[i];
            outBBdn[i] = _bb.Bottom[i];
            outZoneUp[i] =  _covariance[i];
            outZoneDn[i] =  _covariance[i] > _bb.Top[i] ? _bb.Top[i] : _covariance[i] < _bb.Bottom[i] ? _bb.Bottom[i] : _covariance[i];
        }
    }
}
Comments

superiorfunland - January 09, 2023 @ 20:23

Are you willing to enjoy yourself with your little ones at the best fun land for kid? Then, visit Superior Fun Land.

superiorfunland - January 09, 2023 @ 20:47

Are you looking for a piece of legal advice but need help finding it? Then, take assistance for Cloudhaus Law and get excellent legal advice.

prestigeprivaterental - January 09, 2023 @ 21:26

Are you a car lover looking to rent a car that is easy on the eyes to take your breath away? Then, avail yourself of the Prestige Private Rental services today.

jacfletcherqueline - January 11, 2023 @ 05:52

I spent a very long time looking for this specific information. Many thanks and good success the backrooms.

0