Forex_Strategy_Builder.Indicator.Price C# (CSharp) Method

Price() protected static method

Calculates the base price.
protected static Price ( BasePrice price ) : double[]
price BasePrice The base price type.
return double[]
        protected static double[] Price(BasePrice price)
        {
            double[] adPrice = new double[Bars];

            switch(price)
            {
                case BasePrice.Open:
                    adPrice = Open;
                    break;
                case BasePrice.High:
                    adPrice = High;
                    break;
                case BasePrice.Low:
                    adPrice = Low;
                    break;
                case BasePrice.Close:
                    adPrice = Close;
                    break;
                case BasePrice.Median:
                    for (int bar = 0; bar < Bars; bar++)
                        adPrice[bar] = (Low[bar] + High[bar]) / 2;
                    break;
                case BasePrice.Typical:
                    for (int bar = 0; bar < Bars; bar++)
                        adPrice[bar] = (Low[bar] + High[bar] + Close[bar]) / 3;
                    break;
                case BasePrice.Weighted:
                    for (int bar = 0; bar < Bars; bar++)
                        adPrice[bar] = (Low[bar] + High[bar] + 2 * Close[bar]) / 4;
                    break;
                default:
                    break;
            }
            return adPrice;
        }