Ejemplo n.º 1
0
        /// <summary>
        /// Faster MAX
        /// </summary>
        /// <returns></returns>
        public zFastMAX zFastMAX(Data.IDataSeries input, int period)
        {
            if (cachezFastMAX != null)
            {
                for (int idx = 0; idx < cachezFastMAX.Length; idx++)
                {
                    if (cachezFastMAX[idx].Period == period && cachezFastMAX[idx].EqualsInput(input))
                    {
                        return(cachezFastMAX[idx]);
                    }
                }
            }

            lock (checkzFastMAX)
            {
                checkzFastMAX.Period = period;
                period = checkzFastMAX.Period;

                if (cachezFastMAX != null)
                {
                    for (int idx = 0; idx < cachezFastMAX.Length; idx++)
                    {
                        if (cachezFastMAX[idx].Period == period && cachezFastMAX[idx].EqualsInput(input))
                        {
                            return(cachezFastMAX[idx]);
                        }
                    }
                }

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

                zFastMAX[] tmp = new zFastMAX[cachezFastMAX == null ? 1 : cachezFastMAX.Length + 1];
                if (cachezFastMAX != null)
                {
                    cachezFastMAX.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cachezFastMAX       = tmp;
                return(indicator);
            }
        }
Ejemplo n.º 2
0
        protected override void OnStartUp()
        {
            slines = new rwt.SRLine[4];
            rlines = new rwt.SRLine[4];
            for (int i = 0; i < slines.Length; ++i)
            {
                slines[i] = new rwt.SRLine((Bars.BarsType.PeriodType == PeriodType.Volume), i, false);
                newBar   += slines[i].newBar;
                rlines[i] = new rwt.SRLine((Bars.BarsType.PeriodType == PeriodType.Volume), i + 4, true);
                newBar   += rlines[i].newBar;
            }
            mx          = zFastMAX(High, swingStrength);
            mn          = zFastMIN(Low, swingStrength);
            lookForHigh = true;
            mxSeen      = -1;
            mnSeen      = 0;
            barsAgo     = -1;
            tolerance   = plotWithin * TickSize;
            //if(Bars.BarsType.PeriodType==PeriodType.Volume) Log("Able to use simple volume!",LogLevel.Information);

            // ZFader Setup.....keep consistent with ZFader indicator...
            System.Windows.Forms.Control[] coll = ChartControl.Controls.Find("tsrTool", false);
            if (coll.Length > 0)
            {
                strip = (System.Windows.Forms.ToolStrip)coll[0];
                System.Windows.Forms.ToolStripItem[] slider = strip.Items.Find(TBName, false);
                if (slider.Length > 0)
                {
                    tsch = (RWT.ZControlHost)slider[0];
                    tsch.addRef();
                    tbar         = (System.Windows.Forms.TrackBar)tsch.Control;
                    tbar.Scroll += new EventHandler(trackBar1_Scroll);
                }
                else
                {
                    tbar         = new System.Windows.Forms.TrackBar();
                    tbar.Maximum = 255;
                    tbar.Minimum = 0;
                    tbar.Value   = 255;
                    tbar.Scroll += new EventHandler(trackBar1_Scroll);
                    tsch         = new RWT.ZControlHost(tbar, TBName);
                    tsch.addRef();
                    strip.Items.Add(tsch);
                }
            }
        }
Ejemplo n.º 3
0
        protected override void OnStartUp()
        {
            if (intype == RWT_HA.PrimaryOHLC.BARS)
            {
                highSeries = High;
                lowSeries  = Low;
            }
            else
            {
                highSeries = Input;
                lowSeries  = Input;
            }

            maxs     = zFastMAX(highSeries, swingStrength);
            mins     = zFastMIN(lowSeries, swingStrength);
            smoother = RWT_MA.MAFactory.create(type, (double)length);
            smoother.init(lowSeries[0]);
            extseen     = highSeries[0];
            lookForHigh = true;
        }
Ejemplo n.º 4
0
 protected override void OnStartUp()
 {
     zmax = zFastMAX((useJustInput?High:Input), length);
     zmin = zFastMIN((useJustInput?Low:Input), length);
 }