/// <summary> /// The Stochastic Oscillator is made up of two lines that oscillate between a vertical scale of 0 to 100. The %K is the main line and it is drawn as a solid line. The second is the %D line and is a moving average of %K. The %D line is drawn as a dotted line. Use as a buy/sell signal generator, buying when fast moves above slow and selling when fast moves below slow. /// </summary> /// <returns></returns> public Stochastics Stochastics(Data.IDataSeries input, int periodD, int periodK, int smooth) { if (cacheStochastics != null) { for (int idx = 0; idx < cacheStochastics.Length; idx++) { if (cacheStochastics[idx].PeriodD == periodD && cacheStochastics[idx].PeriodK == periodK && cacheStochastics[idx].Smooth == smooth && cacheStochastics[idx].EqualsInput(input)) { return(cacheStochastics[idx]); } } } lock (checkStochastics) { checkStochastics.PeriodD = periodD; periodD = checkStochastics.PeriodD; checkStochastics.PeriodK = periodK; periodK = checkStochastics.PeriodK; checkStochastics.Smooth = smooth; smooth = checkStochastics.Smooth; if (cacheStochastics != null) { for (int idx = 0; idx < cacheStochastics.Length; idx++) { if (cacheStochastics[idx].PeriodD == periodD && cacheStochastics[idx].PeriodK == periodK && cacheStochastics[idx].Smooth == smooth && cacheStochastics[idx].EqualsInput(input)) { return(cacheStochastics[idx]); } } } Stochastics indicator = new Stochastics(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.PeriodD = periodD; indicator.PeriodK = periodK; indicator.Smooth = smooth; Indicators.Add(indicator); indicator.SetUp(); Stochastics[] tmp = new Stochastics[cacheStochastics == null ? 1 : cacheStochastics.Length + 1]; if (cacheStochastics != null) { cacheStochastics.CopyTo(tmp, 0); } tmp[tmp.Length - 1] = indicator; cacheStochastics = tmp; return(indicator); } }
private int plotStoc(int bip) { //Print(Time + " BarsInProgress: " + bip); int strength = 0; Stochastics stoc = Stochastics(BarsArray[bip], periodD, periodK, smooth); // TODO: add color properties // faster line is K, starting up if (Rising(stoc.K) && stoc.K[1] <= 50 && Rising(stoc.D) && stoc.K[0] > stoc.D[0] ) { PlotColors[bip][0] = Color.Green; // Plots[bip][0]=(2); strength = 2; return(strength); } // fast up, d hopefully following if (Rising(stoc.K) && stoc.K[1] <= 50 && Falling(stoc.D) && stoc.K[0] > stoc.D[0] ) { PlotColors[bip][0] = Color.LimeGreen; //Bear0.Set(2); //SumBullWeak.Set(bip); strength = 1; return(strength); } // ending up if (Rising(stoc.K) && stoc.K[1] >= 50 && Rising(stoc.D) && stoc.K[0] > stoc.D[0] ) { PlotColors[bip][0] = Color.LimeGreen; //SumBullWeak.Set(bip); strength = 1; return(strength); } // starting confirmed down if (Falling(stoc.K) && stoc.K[1] >= 50 && Falling(stoc.D) && stoc.K[0] < stoc.D[0] ) { PlotColors[bip][0] = Color.Red; //SumBearStrong.Set(bip); strength = -2; return(strength); } if (Falling(stoc.K) && stoc.K[1] >= 50 && Rising(stoc.D) && stoc.K[0] < stoc.D[0] ) { PlotColors[bip][0] = Color.Pink; //SumBearWeak.Set(bip); strength = -1; return(strength); } if (Falling(stoc.K) && stoc.K[1] < 50 && Falling(stoc.D) && stoc.K[0] < stoc.D[0] ) { PlotColors[bip][0] = Color.Pink; //SumBearWeak.Set(bip); strength = -1; return(strength); } /* * // faster line is K, starting up * if (Rising(stoc.K) * && stoc.K[1] <= 50 * && Rising(stoc.D) * && stoc.K[0] > stoc.D[0] * ) { * SumBullStrong.Set(bip); * strength = 2; * return strength; * } * * // fast up, d hopefully following * if (Rising(stoc.K) * && stoc.K[1] <= 50 * && Falling(stoc.D) * && stoc.K[0] > stoc.D[0] * ) { * SumBullWeak.Set(bip); * strength = 1; * return strength; * } * * // ending up * if (Rising(stoc.K) * && stoc.K[1] >= 50 * && Rising(stoc.D) * && stoc.K[0] > stoc.D[0] * ) { * SumBullWeak.Set(bip); * strength = 1; * return strength; * } * * // starting confirmed down * if (Falling(stoc.K) * && stoc.K[1] >= 50 * && Falling(stoc.D) * && stoc.K[0] < stoc.D[0] * ) { * SumBearStrong.Set(bip); * strength = -2; * return strength; * } * * if (Falling(stoc.K) * && stoc.K[1] >= 50 * && Rising(stoc.D) * && stoc.K[0] < stoc.D[0] * ) { * SumBearWeak.Set(bip); * strength = -1; * return strength; * } * * if (Falling(stoc.K) * && stoc.K[1] < 50 * && Falling(stoc.D) * && stoc.K[0] < stoc.D[0] * ) { * SumBearWeak.Set(bip); * strength = -1; * return strength; * } */ //Print(Time + " Rising(stoc.K): " + Rising(stoc.K) + " Rising(stoc.D): " + Rising(stoc.D) // + " Falling(stoc.K): " + Falling(stoc.K) + " Falling(stoc.D): " + Falling(stoc.D)); /* * // faster line is K * if (Rising(stoc.K) && Rising(stoc.D)) { * SumBullStrong.Set(bip); * strength = 2; * } * if (Rising(stoc.K) && Falling(stoc.D)) { * SumBullWeak.Set(bip); * //SumBullStrong.Set(bip); * strength = 1; * //Print(Time + " Rising(stoc.K): " + Rising(stoc.K) + " Rising(stoc.D): " + Rising(stoc.D) * // + " Falling(stoc.K): " + Falling(stoc.K) + " Falling(stoc.D): " + Falling(stoc.D)); * } * * if (Falling(stoc.K) && Rising(stoc.D)) { * SumBearWeak.Set(bip); * strength = -1; * } * * if (Falling(stoc.K) && Falling(stoc.D)) { * SumBearStrong.Set(bip); * strength = -2; * } */ PlotColors[bip][0] = Color.Gray; return(0); }
/// <summary> /// The Stochastic Oscillator is made up of two lines that oscillate between a vertical scale of 0 to 100. The %K is the main line and it is drawn as a solid line. The second is the %D line and is a moving average of %K. The %D line is drawn as a dotted line. Use as a buy/sell signal generator, buying when fast moves above slow and selling when fast moves below slow. /// </summary> /// <returns></returns> public Stochastics Stochastics(Data.IDataSeries input, int periodD, int periodK, int smooth) { if (cacheStochastics != null) for (int idx = 0; idx < cacheStochastics.Length; idx++) if (cacheStochastics[idx].PeriodD == periodD && cacheStochastics[idx].PeriodK == periodK && cacheStochastics[idx].Smooth == smooth && cacheStochastics[idx].EqualsInput(input)) return cacheStochastics[idx]; lock (checkStochastics) { checkStochastics.PeriodD = periodD; periodD = checkStochastics.PeriodD; checkStochastics.PeriodK = periodK; periodK = checkStochastics.PeriodK; checkStochastics.Smooth = smooth; smooth = checkStochastics.Smooth; if (cacheStochastics != null) for (int idx = 0; idx < cacheStochastics.Length; idx++) if (cacheStochastics[idx].PeriodD == periodD && cacheStochastics[idx].PeriodK == periodK && cacheStochastics[idx].Smooth == smooth && cacheStochastics[idx].EqualsInput(input)) return cacheStochastics[idx]; Stochastics indicator = new Stochastics(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.PeriodD = periodD; indicator.PeriodK = periodK; indicator.Smooth = smooth; Indicators.Add(indicator); indicator.SetUp(); Stochastics[] tmp = new Stochastics[cacheStochastics == null ? 1 : cacheStochastics.Length + 1]; if (cacheStochastics != null) cacheStochastics.CopyTo(tmp, 0); tmp[tmp.Length - 1] = indicator; cacheStochastics = tmp; return indicator; } }
//################################################################### #endregion #region Create forms #if NT7 //##################################################################### /// <summary> /// This method is used to initialize any variables or resources. /// This method is called only once immediately prior to the start of the script, /// but after the Initialize() method. /// </summary> protected override void OnStartUp() { base.OnStartUp(); #region GomCD // Uncomment the next lines to use Gomi's Cumulative Delta stuff ==================== gomCdAll = GomCD(gomCdCalcMode, GomCDChartType.CumulativeChart, "Binary", Gom.FileModeType.OnePerDay, gomCdVolumeFilterSizeMode, gomCdVolumeFilterSize, false); // Uncomment till here ================================================================ #endregion #region Divergence if (divergenceMode != DivergenceMode.False) { switch (divergenceMode) { case DivergenceMode.Custom: // Add custom divergence indicator here break; case DivergenceMode.MACD: macd = MACD(param1, param2, param3); break; case DivergenceMode.Stochastics: stochastics = Stochastics(param1, param2, param3); break; } } #endregion decimal increment = Convert.ToDecimal(Instrument.MasterInstrument.TickSize); int incrementLength = increment.ToString().Length; decimalPlaces = 0; if (incrementLength == 1) decimalPlaces = 0; else if (incrementLength > 2) decimalPlaces = incrementLength - 2; if (ChartControl == null) { statisticPosition = StatisticPositions.False; showRiskManagement = false; } if (statisticPosition != StatisticPositions.False || showRiskManagement) toolStrip = (ToolStrip)ChartControl.Controls["tsrTool"]; #region Statistic panel // Statistic panel ==================================================================== if (statisticPosition != StatisticPositions.False) { DockStyle dockStyle = DockStyle.Bottom; switch (statisticPosition) { case StatisticPositions.Bottom: dockStyle = DockStyle.Bottom; break; case StatisticPositions.Left: dockStyle = DockStyle.Left; break; case StatisticPositions.Right: dockStyle = DockStyle.Right; break; case StatisticPositions.Top: dockStyle = DockStyle.Top; break; default: dockStyle = DockStyle.Bottom; break; } #region Create new control objects // Create new control objects ===================================================== System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); this.panel = new System.Windows.Forms.Panel(); this.label = new System.Windows.Forms.Label(); this.mainTabControl = new System.Windows.Forms.TabControl(); this.tabABC = new System.Windows.Forms.TabPage(); this.tabSwingLength = new System.Windows.Forms.TabPage(); this.tabSwingRelation = new System.Windows.Forms.TabPage(); this.lengthList = new System.Windows.Forms.DataGridView(); this.colLengthDirection = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colLengthSwingCount = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colLengthLength = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colLengthLastLength = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colLengthDuration = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colLengthLastDuration = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.relationList = new System.Windows.Forms.DataGridView(); this.colRelationSwing = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colRelationSwingCount = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colRelationHigherHigh = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colRelationLowerHigh = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colRelationHigherLow = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colRelationLowerLow = new System.Windows.Forms.DataGridViewTextBoxColumn(); //================================================================================= #endregion #region Tab Swing Length //===== Tab Swing Length ========================================================== // // colLengthDirection // this.colLengthDirection.HeaderText = "Direction"; this.colLengthDirection.Name = "colLengthDirection"; this.colLengthDirection.ReadOnly = true; this.colLengthDirection.Width = 120; // // colLengthSwingCount // this.colLengthSwingCount.HeaderText = "Swing Count"; this.colLengthSwingCount.Name = "colLengthSwingCount"; this.colLengthSwingCount.ReadOnly = true; this.colLengthSwingCount.Width = 120; // // colLengthLength // this.colLengthLength.HeaderText = "Length"; this.colLengthLength.Name = "colLengthLength"; this.colLengthLength.ReadOnly = true; this.colLengthLength.Width = 120; // // colLengthLastLength // this.colLengthLastLength.HeaderText = "Last Length"; this.colLengthLastLength.Name = "colLengthLastLength"; this.colLengthLastLength.ReadOnly = true; this.colLengthLastLength.Width = 120; // // colLengthDuration // this.colLengthDuration.HeaderText = "Duration"; this.colLengthDuration.Name = "colLengthDuration"; this.colLengthDuration.ReadOnly = true; this.colLengthDuration.Width = 120; // // colLengthLastDuration // this.colLengthLastDuration.HeaderText = "Last Duration"; this.colLengthLastDuration.Name = "colLengthLastDuration"; this.colLengthLastDuration.ReadOnly = true; this.colLengthLastDuration.Width = 120; // // lengthList // this.lengthList.AllowUserToAddRows = false; this.lengthList.AllowUserToDeleteRows = false; this.lengthList.AllowUserToResizeColumns = false; this.lengthList.AllowUserToResizeRows = false; this.lengthList.BackgroundColor = System.Drawing.SystemColors.Control; this.lengthList.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.lengthList.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.colLengthDirection, this.colLengthSwingCount, this.colLengthLength, this.colLengthLastLength, this.colLengthDuration, this.colLengthLastDuration}); dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight; dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Window; dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.ControlText; dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.False; this.lengthList.DefaultCellStyle = dataGridViewCellStyle1; this.lengthList.Dock = System.Windows.Forms.DockStyle.Fill; this.lengthList.Location = new System.Drawing.Point(3, 3); this.lengthList.Name = "lengthList"; this.lengthList.ReadOnly = true; this.lengthList.Rows.Add("Up"); this.lengthList.Rows.Add("Down"); this.lengthList.RowHeadersVisible = false; this.lengthList.RowTemplate.Height = 24; this.lengthList.Size = new System.Drawing.Size(920, 305); this.lengthList.TabIndex = 0; // // tabSwingLength // this.tabSwingLength.Controls.Add(this.lengthList); this.tabSwingLength.Location = new System.Drawing.Point(4, 25); this.tabSwingLength.Name = "tabSwingLength"; this.tabSwingLength.Padding = new System.Windows.Forms.Padding(3); this.tabSwingLength.TabIndex = 1; this.tabSwingLength.Text = "Swing Length"; this.tabSwingLength.UseVisualStyleBackColor = true; //================================================================================= #endregion #region Tab Swing Relation //===== Tab Swing Relation ======================================================== // // colRelationSwing // this.colRelationSwing.HeaderText = "Swing"; this.colRelationSwing.Name = "colRelationSwing"; this.colRelationSwing.ReadOnly = true; this.colRelationSwing.Width = 120; // // colRelationSwingCount // this.colRelationSwingCount.HeaderText = "Swing Count"; this.colRelationSwingCount.Name = "colRelationSwingCount"; this.colRelationSwingCount.ReadOnly = true; this.colRelationSwingCount.Width = 120; // // colRelationHigherHigh // this.colRelationHigherHigh.HeaderText = "Higher High"; this.colRelationHigherHigh.Name = "colRelationHigherHigh"; this.colRelationHigherHigh.ReadOnly = true; this.colRelationHigherHigh.Width = 120; // // colRelationLowerHigh // this.colRelationLowerHigh.HeaderText = "Lower High"; this.colRelationLowerHigh.Name = "colRelationLowerHigh"; this.colRelationLowerHigh.ReadOnly = true; this.colRelationLowerHigh.Width = 120; // // colRelationHigherLow // this.colRelationHigherLow.HeaderText = "Higher Low"; this.colRelationHigherLow.Name = "colRelationHigherLow"; this.colRelationHigherLow.ReadOnly = true; this.colRelationHigherLow.Width = 120; // // colRelationLowerLow // this.colRelationLowerLow.HeaderText = "Lower Low"; this.colRelationLowerLow.Name = "colRelationLowerLow"; this.colRelationLowerLow.ReadOnly = true; this.colRelationLowerLow.Width = 120; // // relationList // this.relationList.AllowUserToAddRows = false; this.relationList.AllowUserToDeleteRows = false; this.relationList.AllowUserToResizeColumns = false; this.relationList.AllowUserToResizeRows = false; this.relationList.BackgroundColor = System.Drawing.SystemColors.Control; this.relationList.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.relationList.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.colRelationSwing, this.colRelationSwingCount, this.colRelationHigherHigh, this.colRelationLowerHigh, this.colRelationHigherLow, this.colRelationLowerLow}); this.relationList.DefaultCellStyle = dataGridViewCellStyle1; this.relationList.Dock = System.Windows.Forms.DockStyle.Fill; this.relationList.Location = new System.Drawing.Point(3, 3); this.relationList.Name = "relationList"; this.relationList.ReadOnly = true; this.relationList.Rows.Add("Higher High"); this.relationList.Rows.Add("Lower High"); this.relationList.Rows.Add("Double Top"); this.relationList.Rows.Add("Lower Low"); this.relationList.Rows.Add("Higher Low"); this.relationList.Rows.Add("Double Bottom"); this.relationList.RowHeadersVisible = false; this.relationList.RowTemplate.Height = 24; this.relationList.Size = new System.Drawing.Size(986, 240); this.relationList.TabIndex = 1; // // tabSwingRelation // this.tabSwingRelation.Controls.Add(this.relationList); this.tabSwingRelation.Location = new System.Drawing.Point(4, 25); this.tabSwingRelation.Name = "tabSwingRelation"; this.tabSwingRelation.Padding = new System.Windows.Forms.Padding(3); this.tabSwingRelation.TabIndex = 2; this.tabSwingRelation.Text = "Swing Relation"; this.tabSwingRelation.UseVisualStyleBackColor = true; //================================================================================= #endregion #region Add button to the tool strip and create main controls //===== Add button to the tool strip ============================================== // // toolStripSeparator // toolStripSeparator = new System.Windows.Forms.ToolStripSeparator(); toolStripSeparator.Name = "separator"; // // Add controls to the toolstrip // toolStrip.Items.Add(toolStripSeparator); toolStripButton = new System.Windows.Forms.ToolStripButton("Hide Extras"); toolStripButton.Name = "button"; toolStripButton.Text = "Show Statistic"; toolStripButton.Click += buttonClick; toolStripButton.Enabled = true; toolStripButton.ForeColor = Color.Black; toolStrip.Items.Add(toolStripButton); this.splitter = new System.Windows.Forms.Splitter(); this.splitter.Name = "splitter"; this.splitter.BackColor = Color.LightGray; this.splitter.Dock = dockStyle; this.splitter.Hide(); this.splitter.Width = 3; ChartControl.Controls.Add(this.splitter); //===== Create panel and main tab ================================================= this.panel = new System.Windows.Forms.Panel(); this.mainTabControl = new System.Windows.Forms.TabControl(); // // mainTabControl // this.mainTabControl.Controls.Add(this.tabSwingLength); this.mainTabControl.Controls.Add(this.tabSwingRelation); this.mainTabControl.Dock = System.Windows.Forms.DockStyle.Fill; this.mainTabControl.Location = new System.Drawing.Point(0, 0); this.mainTabControl.Multiline = true; this.mainTabControl.Name = "mainTabControl"; this.mainTabControl.Padding = new System.Drawing.Point(3, 3); this.mainTabControl.SelectedIndex = 3; this.mainTabControl.TabIndex = 0; // // panel // this.panel.BackColor = System.Drawing.Color.White; this.panel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; //this.panel.Controls.Add(this.label); this.panel.Controls.Add(this.mainTabControl); this.panel.Dock = dockStyle; this.panel.Location = new System.Drawing.Point(0, 0); this.panel.MinimumSize = new System.Drawing.Size(150, 0); this.panel.Name = "panel"; this.panel.Hide(); if (dockStyle == DockStyle.Bottom || dockStyle == DockStyle.Top) this.panel.Size = new System.Drawing.Size(ChartControl.Width, 210); else this.panel.Size = new System.Drawing.Size(250, ChartControl.Height); this.panel.TabIndex = 0; ChartControl.Controls.Add(this.panel); //================================================================================= #endregion } // End statistic panel ================================================================ #endregion #region Riskmanagement items // Riskmanagement items =============================================================== if (showRiskManagement) { #region Create new control objects // Create new control objects ===================================================== toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); toolStripLabelQty = new System.Windows.Forms.ToolStripLabel("toolStripLabelQty"); toolStripLabelRiskReward = new System.Windows.Forms.ToolStripLabel("toolStripLabelRiskReward"); toolStripLabelLoss = new System.Windows.Forms.ToolStripLabel("toolStripLabelLoss"); toolStripLabelProfit = new System.Windows.Forms.ToolStripLabel("toolStripLabelProfit"); toolStripLabelEntry = new System.Windows.Forms.ToolStripLabel("toolStripLabelEntry"); toolStripLabelStop = new System.Windows.Forms.ToolStripLabel("toolStripLabelStop"); toolStripLabelTarget = new System.Windows.Forms.ToolStripLabel("toolStripLabelTarget"); numericUpDownEntry = new System.Windows.Forms.NumericUpDown(); numericUpDownStop = new System.Windows.Forms.NumericUpDown(); numericUpDownTarget = new System.Windows.Forms.NumericUpDown(); //================================================================================= #endregion #region Add button to the tool strip and create main controls // Properties of ToolStrip items ================================================== // // toolStripSeparator // toolStripSeparator1.Name = "toolStripSeparator1"; toolStripSeparator2.Name = "toolStripSeparator2"; toolStripSeparator3.Name = "toolStripSeparator3"; // // toolStripLabelQty // toolStripLabelQty.AutoSize = false; toolStripLabelQty.ForeColor = System.Drawing.Color.Black; toolStripLabelQty.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); toolStripLabelQty.Name = "toolStripLabelQty"; toolStripLabelQty.Size = new System.Drawing.Size(126, 22); toolStripLabelQty.Text = "Qty: "; toolStripLabelQty.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // toolStripLabelRiskReward // toolStripLabelRiskReward.AutoSize = false; toolStripLabelRiskReward.ForeColor = System.Drawing.Color.Black; toolStripLabelRiskReward.Name = "toolStripLabelRiskReward"; toolStripLabelRiskReward.Size = new System.Drawing.Size(78, 22); toolStripLabelRiskReward.Text = "R/R: "; toolStripLabelRiskReward.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // toolStripLabelLoss // toolStripLabelLoss.AutoSize = false; toolStripLabelLoss.ForeColor = System.Drawing.Color.Black; toolStripLabelLoss.Name = "toolStripLabelLoss"; toolStripLabelLoss.Size = new System.Drawing.Size(96, 22); toolStripLabelLoss.Text = "Loss: "; toolStripLabelLoss.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // toolStripLabelProfit // toolStripLabelProfit.AutoSize = false; toolStripLabelProfit.ForeColor = System.Drawing.Color.Black; toolStripLabelProfit.Name = "toolStripLabelProfit"; toolStripLabelProfit.Size = new System.Drawing.Size(96, 22); toolStripLabelProfit.Text = "Win: "; toolStripLabelProfit.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // toolStripLabelEntry // toolStripLabelEntry.AutoSize = true; toolStripLabelEntry.ForeColor = System.Drawing.Color.Black; toolStripLabelEntry.Name = "toolStripLabelEntry"; toolStripLabelEntry.Text = "Entry: "; // // toolStripLabelStop // toolStripLabelStop.AutoSize = true; toolStripLabelStop.ForeColor = System.Drawing.Color.Red; toolStripLabelStop.Name = "toolStripLabelStop"; toolStripLabelStop.Text = " SL: "; // // toolStripLabelTarget // toolStripLabelTarget.AutoSize = true; toolStripLabelTarget.ForeColor = System.Drawing.Color.Green; toolStripLabelTarget.Name = "toolStripLabelTarget"; toolStripLabelTarget.Text = " PT: "; // // numericUpDownEntry // numericUpDownEntry.DecimalPlaces = decimalPlaces; numericUpDownEntry.Increment = increment; numericUpDownEntry.Maximum = new decimal(new int[] { 999999, 0, 0, 0}); numericUpDownEntry.Name = "numericUpDownEntry"; numericUpDownEntry.Size = new System.Drawing.Size(90, 22); numericUpDownEntry.TabIndex = 0; numericUpDownEntry.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; numericUpDownEntry.ThousandsSeparator = true; numericUpDownEntry.UpDownAlign = System.Windows.Forms.LeftRightAlignment.Left; numericUpDownEntry.Value = new decimal(new int[] { 1000, 0, 0, 0}); numericUpDownEntry.ValueChanged += new System.EventHandler(numericUpDown_ValueChanged); // // numericUpDownStop // numericUpDownStop.DecimalPlaces = decimalPlaces; numericUpDownStop.Increment = increment; numericUpDownStop.Maximum = new decimal(new int[] { 999999, 0, 0, 0}); numericUpDownStop.Name = "numericUpDownStop"; numericUpDownStop.Size = new System.Drawing.Size(90, 22); numericUpDownStop.TabIndex = 10; numericUpDownStop.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; numericUpDownStop.ThousandsSeparator = true; numericUpDownStop.UpDownAlign = System.Windows.Forms.LeftRightAlignment.Left; numericUpDownStop.Value = new decimal(new int[] { 995, 0, 0, 0}); numericUpDownStop.ValueChanged += new System.EventHandler(numericUpDown_ValueChanged); // // numericUpDownTarget // numericUpDownTarget.DecimalPlaces = decimalPlaces; numericUpDownTarget.Increment = increment; numericUpDownTarget.Maximum = new decimal(new int[] { 999999, 0, 0, 0}); numericUpDownTarget.Name = "numericUpDownTarget"; numericUpDownTarget.Size = new System.Drawing.Size(90, 22); numericUpDownTarget.TabIndex = 9; numericUpDownTarget.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; numericUpDownTarget.ThousandsSeparator = true; numericUpDownTarget.UpDownAlign = System.Windows.Forms.LeftRightAlignment.Left; numericUpDownTarget.Value = new decimal(new int[] { 1010, 0, 0, 0}); numericUpDownTarget.ValueChanged += new System.EventHandler(numericUpDown_ValueChanged); // // Add controls to the toolstrip // toolStripControlHostEntry = new ToolStripControlHost(numericUpDownEntry, "toolStripControlHostEntry"); toolStripControlHostEntry.AutoSize = false; toolStripControlHostStop = new ToolStripControlHost(numericUpDownStop, "toolStripControlHostStop"); toolStripControlHostStop.AutoSize = false; toolStripControlHostTarget = new ToolStripControlHost(numericUpDownTarget, "toolStripControlHostTarget"); toolStripControlHostTarget.AutoSize = false; toolStrip.Items.Add(toolStripSeparator1); toolStrip.Items.Add(toolStripLabelQty); toolStrip.Items.Add(toolStripSeparator2); toolStrip.Items.Add(toolStripLabelRiskReward); toolStrip.Items.Add(toolStripLabelLoss); toolStrip.Items.Add(toolStripLabelProfit); toolStrip.Items.Add(toolStripSeparator3); toolStrip.Items.Add(toolStripLabelEntry); toolStrip.Items.Add(toolStripControlHostEntry); toolStrip.Items.Add(toolStripLabelStop); toolStrip.Items.Add(toolStripControlHostStop); toolStrip.Items.Add(toolStripLabelTarget); toolStrip.Items.Add(toolStripControlHostTarget); //================================================================================= #endregion } // End riskmanagement items =========================================================== #endregion }