// User defined variables (add any user defined variables below) #endregion private rwt.SRLine availableLine(bool fromHigh) { var lines = (fromHigh?rlines:slines); rwt.SRLine oldest = null; foreach (rwt.SRLine l in lines) { if (oldest == null) { oldest = l; } if (!oldest.Enabled) { if (!l.Enabled && l.isOlder(oldest)) { oldest = l; } } else { if (!l.Enabled) { oldest = l; } else if (l.isOlder(oldest)) { oldest = l; } } } oldest.Enabled = false; return(oldest); }
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); } } }
private void addLine(int ba /*bars ago*/, bool swingHigh) { // locate an entry in the array... rwt.SRLine l = availableLine(swingHigh); l.Enabled = true; // backfill the data and plot... if (CurrentBar > ba) { Values[l.WhichPlot].Reset(ba + 1); } for (int i = ba; i >= 0; --i) { l.newBar(Volume[i], Median[i], High[i], Low[i]); Values[l.WhichPlot].Set(i, l.Location); } }