annu free

by anuragmridha99 in category Trend at 07/06/2021
Description

trend

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.Indicators;

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true, AccessRights = AccessRights.None)]
    public class BelkhayatePolynomialRegressionHistory : Indicator
    {
        [Parameter(DefaultValue = 3.0, MinValue = 1, MaxValue = 4)]
        public int degree { get; set; }

        [Parameter(DefaultValue = 120)]
        public int period { get; set; }

        [Parameter(DefaultValue = 1.4)]
        public double strdDev { get; set; }

        [Parameter(DefaultValue = 2.4)]
        public double strdDev2 { get; set; }

        [Parameter(DefaultValue = 3.4)]
        public double strdDev3 { get; set; }

        [Output("PRC", Color = Colors.Gray, LineStyle = LineStyle.Lines)]
        public IndicatorDataSeries prc { get; set; }

        [Output("SQH", Color = Colors.Red, LineStyle = LineStyle.Lines)]
        public IndicatorDataSeries sqh { get; set; }

        [Output("SQL", Color = Colors.Blue, LineStyle = LineStyle.Lines)]
        public IndicatorDataSeries sql { get; set; }

        [Output("SQL2", Color = Colors.Blue, LineStyle = LineStyle.Lines)]
        public IndicatorDataSeries sql2 { get; set; }

        [Output("SQH2", Color = Colors.Red, LineStyle = LineStyle.Lines)]
        public IndicatorDataSeries sqh2 { get; set; }

        [Output("SQL3", Color = Colors.Blue, LineStyle = LineStyle.Lines)]
        public IndicatorDataSeries sql3 { get; set; }

        [Output("SQH3", Color = Colors.Red, LineStyle = LineStyle.Lines)]
        public IndicatorDataSeries sqh3 { get; set; }


        [Output("HPRC", Color = Colors.Gray, PlotType = PlotType.Points, Thickness = 2)]
        public IndicatorDataSeries Hprc { get; set; }

        [Output("HSQH", Color = Colors.Red, PlotType = PlotType.Points, Thickness = 2)]
        public IndicatorDataSeries Hsqh { get; set; }

        [Output("HSQL", Color = Colors.Blue, PlotType = PlotType.Points, Thickness = 2)]
        public IndicatorDataSeries Hsql { get; set; }

        [Output("HSQL2", Color = Colors.Blue, PlotType = PlotType.Points, Thickness = 2)]
        public IndicatorDataSeries Hsql2 { get; set; }

        [Output("HSQH2", Color = Colors.Red, PlotType = PlotType.Points, Thickness = 2)]
        public IndicatorDataSeries Hsqh2 { get; set; }

        [Output("HSQL3", Color = Colors.Blue, PlotType = PlotType.Points, Thickness = 2)]
        public IndicatorDataSeries Hsql3 { get; set; }

        [Output("HSQH3", Color = Colors.Red, PlotType = PlotType.Points, Thickness = 2)]
        public IndicatorDataSeries Hsqh3 { get; set; }



        public int ix { get; set; }

        private double[,] ai = new double[10, 10];
        private double[] b = new double[10];
        private double[] x = new double[10];
        private double[] sx = new double[10];
        private double sum;
        private int ip;
        private int p;
        private int n;
        private int f;
        private double qq;
        private double mm;
        private double tt;
        private int ii;
        private int jj;
        private int kk;
        private int ll;
        private int nn;
        private double sq;
        private double sq2;
        private double sq3;
        private int i0 = 0;
        private int mi;

        public override void Calculate(int index)
        {
            //if (!IsLastBar || index < period)
            //return;

            int i = index;
            ix = i;
            ip = period;
            p = ip;
            sx[1] = p + 1;
            nn = degree + 1;
            //----------------------sx-------------------------------------------------------------------
            // 

            for (mi = 1; mi <= nn * 2 - 2; mi++)
            {
                sum = 0;
                for (n = i0; n <= i0 + p; n++)
                {
                    sum += Math.Pow(n, mi);
                }
                sx[mi + 1] = sum;
            }
            //----------------------syx-----------

            for (mi = 1; mi <= nn; mi++)
            {
                sum = 0.0;
                for (n = i0; n <= i0 + p; n++)
                {
                    if (mi == 1)
                        sum += MarketSeries.Close[index - n];
                    else
                        sum += MarketSeries.Close[index - n] * Math.Pow(n, mi - 1);
                }
                b[mi] = sum;
            }
            //===============Matrix=======================================================================================================

            for (jj = 1; jj <= nn; jj++)
            {
                for (ii = 1; ii <= nn; ii++)
                {
                    kk = ii + jj - 1;
                    ai[ii, jj] = sx[kk];
                }
            }

            //===============Gauss========================================================================================================
            for (kk = 1; kk <= nn - 1; kk++)
            {
                ll = 0;
                mm = 0;
                for (ii = kk; ii <= nn; ii++)
                {
                    if (Math.Abs(ai[ii, kk]) > mm)
                    {
                        mm = Math.Abs(ai[ii, kk]);
                        ll = ii;
                    }
                }
                if (ll == 0)
                    return;
                if (ll != kk)
                {
                    for (jj = 1; jj <= nn; jj++)
                    {
                        tt = ai[kk, jj];
                        ai[kk, jj] = ai[ll, jj];
                        ai[ll, jj] = tt;
                    }
                    tt = b[kk];
                    b[kk] = b[ll];
                    b[ll] = tt;
                }
                for (ii = kk + 1; ii <= nn; ii++)
                {
                    qq = ai[ii, kk] / ai[kk, kk];
                    for (jj = 1; jj <= nn; jj++)
                    {
                        if (jj == kk)
                            ai[ii, jj] = 0;
                        else
                            ai[ii, jj] = ai[ii, jj] - qq * ai[kk, jj];
                    }
                    b[ii] = b[ii] - qq * b[kk];
                }
            }

            x[nn] = b[nn] / ai[nn, nn];
            for (ii = nn - 1; ii >= 1; ii--)
            {
                tt = 0;
                for (jj = 1; jj <= nn - ii; jj++)
                {
                    tt = tt + ai[ii, ii + jj] * x[ii + jj];
                    x[ii] = (1 / ai[ii, ii]) * (b[ii] - tt);
                }
            }
            sq = 0.0;
            sq2 = 0.0;
            sq3 = 0.0;
            for (n = i0; n <= i0 + p; n++)
            {
                sum = 0;
                for (kk = 1; kk <= degree; kk++)
                {
                    sum += x[kk + 1] * Math.Pow(n, kk);
                }

                prc[index - n] = (x[1] + sum);
                sq += Math.Pow(MarketSeries.Close[index - n] - prc[index - n], 2);
                sq2 = sq;
                sq3 = sq;
            }

            sq = Math.Sqrt(sq / (p + 1)) * strdDev;
            sq2 = Math.Sqrt(sq2 / (p + 1)) * strdDev2;
            sq3 = Math.Sqrt(sq3 / (p + 1)) * strdDev3;
            for (n = 0; n <= period; n++)
            {

                sqh[index - n] = prc[index - n] + sq;
                sqh2[index - n] = prc[index - n] + sq2;
                sqh3[index - n] = prc[index - n] + sq3;
                sql[index - n] = prc[index - n] - sq;
                sql2[index - n] = prc[index - n] - sq2;
                sql3[index - n] = prc[index - n] - sq3;
            }

            prc[index - period] = double.NaN;
            sqh[index - period] = double.NaN;
            sqh2[index - period] = double.NaN;
            sqh3[index - period] = double.NaN;
            sql[index - period] = double.NaN;
            sql2[index - period] = double.NaN;
            sql3[index - period] = double.NaN;

            Hprc[index] = prc[index];
            Hsqh[index] = sqh[index];
            Hsqh2[index] = sqh2[index];
            Hsqh3[index] = sqh3[index];
            Hsql[index] = sql[index];
            Hsql2[index] = sql2[index];
            Hsql3[index] = sql3[index];
        }


    }
}
Comments

gamfieldpolite - May 10, 2022 @ 12:08

Similar to regular Pivot Points but Pivot Line is calculated with more weight to the closing price. Pivot Points is a method for calculating support and resistance levels. Resistance and support levels indicate where a major price movement is expected. As a trend indicator, it indicates an upward movement, for instance, if the pivot point price is broken in, then the market is bullish, and vice versa. Pivot points are short-term trend indicators, however and therefore useful for only one day. The second method is to use pivot point price levels to enter and exit the markets.

=> Hprc[index] = prc[spider solitaire];

            Hsqh[index] = sqh[index];

            Hsqh2[index] = sqh2[index];

 

smithlinda1502 - July 06, 2022 @ 09:52

Hi there, what's your favorite activity in your leisure time? Do you often play online games? I know an interesting sports game named basketball stars. I really like this game. It helps me relax a lot after stressful working hours. Let's try it, you will like it!

donnajane1205 - July 08, 2022 @ 06:53

Thanks for the information you shared. I will often come in to read the information. Numberle and 5 letter words is a very fun word game. It's playing and learning at the same time

abeljame1303 - July 15, 2022 @ 11:59

Thanks for your post, it's very helpful. The cladder is playing and learning at the same time

ruliamarian0801 - September 10, 2022 @ 10:21

I strongly fall guys recommend buying a separate phone, especially if <a href="https://wordleonline.com/">wordle online</a> you have your own business.

ruliamarian0801 - September 10, 2022 @ 10:22

I am so lucky fall guys to have you, I have learned a lot from your wordle online words learn to live to give to myself.

johndavidd8888 - September 12, 2022 @ 05:18

Thanks for your phrazle article. I have understood more about it, and appreciate such detailed article. I hope to read more of your weaver game articles in the future. 

amritsinghkalsi2022 - November 01, 2022 @ 08:26

Powergenx is India’s largest online health & fitness store for men and women. Shop online from the latest collections of health, fitness and similar products featuring the best brands.Know more: Supplement Store Online | Whey protein | Mass gainer

jainmisha45 - November 01, 2022 @ 13:22

Thanks and visit: Play online matka
 

helperji25 - November 09, 2022 @ 10:30

We are the perfect locations for you in the event that you are searching for a dependable Homegrown partner to lessen your endless house errands and save a ton of time. It is critical to painstakingly pick your homegrown assistant. As some unacceptable decision can be an all out cerebral pain for your home and family.KNOW MORE:


[url=https://www.helperji.in/]Professional Deep Cleaning Services[/url]

[url=https://www.helperji.in/]Kitchen Cleaning in Noida[/url]

[url=https://www.helperji.in/]cleaning services in delhi[/url]

[url=https://www.helperji.in/]home cleaning services delhi[/url]

[url=https://www.helperji.in/]house deep cleaning service near me[/url]

 

helperji25 - November 09, 2022 @ 10:31

We are the perfect locations for you in the event that you are searching for a dependable Homegrown partner to lessen your endless house errands and save a ton of time. It is critical to painstakingly pick your homegrown assistant. As some unacceptable decision can be an all out cerebral pain for your home and family.KNOW MORE:

 

Professional Deep Cleaning Services | Kitchen Cleaning in Noida | cleaning services in delhi | home cleaning services delhi | house deep cleaning service near me

 

johnmoody095 - December 13, 2022 @ 14:28

Thanks a ton for sharing such content. Visit us: Online matka play
 

amritsinghkalsi2022 - December 15, 2022 @ 09:32

As Powergenx is more than a nutrition brand. It’s a partner on your fitness journey. There are a number of fitness products available from Powergenx that can assist you in achieving your fitness targets. Know moreOn whey protein | Hyde Pre workout | Gym Supplements | C4 pre workout | Avvatar whey protein

bennychang971 - January 02, 2023 @ 04:57

Insurance companies in Indonesia have been growing steadily in the past few years. These companies provide many different types of insurance, including health, life, auto, property, and travel insurance. The insurance sector in Indonesia is highly regulated and requires companies to be licensed and have appropriate documents in order to operate. Many of these companies have adopted modern technology, allowing customers to purchase insurance policies online and make payments via digital payment systems. In addition, the government has recently implemented new regulations to make insurance services more accessible and to ensure that consumers are provided with better services. This has enabled insurance companies to expand their services, reach more customers, and increase their profits.

amritsinghkalsi2022 - January 13, 2023 @ 13:04

 It is Ethereum's organization impact that becomes as increasingly more applications and crypto projects are based on the Ethereum stage. Because of its unmistakable and genuine utility, Ethereum can be utilized in different ways. Digital forms of money other than Bitcoin experience difficulty carrying out this concept. KNOW MORE:  buy bitcoin in dubai | sell bitcoin in dubai | Cashing out crypto in Dubai | Buy USDT with cash | Buy USDT with AED

0