/// <summary>
        /// Plots the open, high, low and close values from the session starting on the prior day.
        /// </summary>
        /// <returns></returns>
        public PriorDayOHLC PriorDayOHLC(Data.IDataSeries input)
        {
            if (cachePriorDayOHLC != null)
            {
                for (int idx = 0; idx < cachePriorDayOHLC.Length; idx++)
                {
                    if (cachePriorDayOHLC[idx].EqualsInput(input))
                    {
                        return(cachePriorDayOHLC[idx]);
                    }
                }
            }

            lock (checkPriorDayOHLC)
            {
                if (cachePriorDayOHLC != null)
                {
                    for (int idx = 0; idx < cachePriorDayOHLC.Length; idx++)
                    {
                        if (cachePriorDayOHLC[idx].EqualsInput(input))
                        {
                            return(cachePriorDayOHLC[idx]);
                        }
                    }
                }

                PriorDayOHLC indicator = new PriorDayOHLC();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                Indicators.Add(indicator);
                indicator.SetUp();

                PriorDayOHLC[] tmp = new PriorDayOHLC[cachePriorDayOHLC == null ? 1 : cachePriorDayOHLC.Length + 1];
                if (cachePriorDayOHLC != null)
                {
                    cachePriorDayOHLC.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cachePriorDayOHLC   = tmp;
                return(indicator);
            }
        }
        protected override void MyInitialize()
        {
          //  TraceOrders = true;

            _exitType = ExitType.TrailingATR;

            _indiPrior = PriorDayOHLC();
            _indiPrior.ShowClose = false;
            _indiPrior.ShowOpen = false;
            Add(_indiPrior);
            
            Add(EMAofATR(MMAtrMultiplier, MMAtrEMAPeriod));

            Add(PeriodType.Day, 1);
           

            //      SetTrailStop(CalculationMode.Ticks, 15);
            //SetStopLoss(CalculationMode.Ticks, 20);
            //SetProfitTarget(CalculationMode.Ticks, 30);

        }
        /// <summary>
        /// Plots the open, high, low and close values from the session starting on the prior day.
        /// </summary>
        /// <returns></returns>
        public PriorDayOHLC PriorDayOHLC(Data.IDataSeries input)
        {
            if (cachePriorDayOHLC != null)
                for (int idx = 0; idx < cachePriorDayOHLC.Length; idx++)
                    if (cachePriorDayOHLC[idx].EqualsInput(input))
                        return cachePriorDayOHLC[idx];

            lock (checkPriorDayOHLC)
            {
                if (cachePriorDayOHLC != null)
                    for (int idx = 0; idx < cachePriorDayOHLC.Length; idx++)
                        if (cachePriorDayOHLC[idx].EqualsInput(input))
                            return cachePriorDayOHLC[idx];

                PriorDayOHLC indicator = new PriorDayOHLC();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                Indicators.Add(indicator);
                indicator.SetUp();

                PriorDayOHLC[] tmp = new PriorDayOHLC[cachePriorDayOHLC == null ? 1 : cachePriorDayOHLC.Length + 1];
                if (cachePriorDayOHLC != null)
                    cachePriorDayOHLC.CopyTo(tmp, 0);
                tmp[tmp.Length - 1] = indicator;
                cachePriorDayOHLC = tmp;
                return indicator;
            }
        }