Ejemplo n.º 1
0
        /*
         * private static int testPeriod = 9;
         * private MySMA mySma = new MySMA( testPeriod );
         * private MySUM mySum = new MySUM( testPeriod );
         * private MyMAX myMax = new MyMAX( testPeriod );
         * private MyMIN myMin = new MyMIN( testPeriod );
         */
        #endregion

        /// <summary>
        /// This method is used to configure the indicator and is called once before any bar data is loaded.
        /// </summary>
        protected override void Initialize()
        {
            CalculateOnBarClose = true;
            Overlay             = true;
            PriceTypeSupported  = false;

            lastBar = 0;
            try
            {
                emasSlow    = new MyEMA[indicators];
                emasFast    = new MyEMA[indicators];
                macds       = new MyMACD[indicators];
                rsis        = new MyRSI[indicators];
                ccis        = new MyCCI[indicators];
                stochastics = new MyStochastics[indicators];
                lastMin     = new int[indicators - 1];
                tfHigh      = new double[indicators - 1];
                tfLow       = new double[indicators - 1];
                timeFrames  = new int[] { 5, 15, 30, 60, 240 };

                for (int i = 0; i < indicators; i++)
                {
                    emasSlow[i]    = new MyEMA(EmaSlowPeriod);
                    emasFast[i]    = new MyEMA(EmaFastPeriod);
                    macds[i]       = new MyMACD(MACDFast, MACDSlow, MACDSmooth);
                    rsis[i]        = new MyRSI(RSIPeriod, RSISmooth);
                    ccis[i]        = new MyCCI(CCIPeriod);
                    stochastics[i] = new MyStochastics(StochasticsD, StochasticsK, StochasticsSmooth);
                }
            }
            catch (Exception ex)
            {
                Print(ex.ToString());
            }
        }
Ejemplo n.º 2
0
 public MyMACD(int Fast, int Slow, int Smooth)
 {
     avg         = 0;
     diff        = 0;
     this.Fast   = Fast;
     this.Slow   = Slow;
     this.Smooth = Smooth;
     fastEma     = new MyEMA(Fast);
     slowEma     = new MyEMA(Slow);
 }