private void PrintPoint(DowPivotOld dowPivot) { if (!dowPivot.DrawProp.ShowTopBottomPoints) { return; } switch (trendDir) { case TrendDir.Down: Draw.Dot(dowPivot, (trendDir + " Dot " + PointIndex.ToString()), true, Miscellaneous.ConvertBarIndexToBarsAgo(dowPivot, BarIndex), Price, Brushes.Red).OutlineBrush = Brushes.Transparent; Draw.Text(dowPivot, trendDir + " Text " + PointIndex.ToString(), true, PointIndex.ToString(), Miscellaneous.ConvertBarIndexToBarsAgo(dowPivot, BarIndex), Price, -15, Brushes.White, new Gui.Tools.SimpleFont("Arial", 11), System.Windows.TextAlignment.Center, Brushes.Transparent, Brushes.Transparent, 100); break; case TrendDir.Up: Draw.Dot(dowPivot, (trendDir + " Dot " + PointIndex.ToString()), true, Miscellaneous.ConvertBarIndexToBarsAgo(dowPivot, BarIndex), Price, Brushes.Green).OutlineBrush = Brushes.Transparent; Draw.Text(dowPivot, trendDir + " Text " + PointIndex.ToString(), true, PointIndex.ToString(), Miscellaneous.ConvertBarIndexToBarsAgo(dowPivot, BarIndex), Price, 15, Brushes.White, new Gui.Tools.SimpleFont("Arial", 11), System.Windows.TextAlignment.Center, Brushes.Transparent, Brushes.Transparent, 100); break; } }
private void SetProfitTargetPrice(DowPivotOld dowPivot, PivotPoint pp, TrendDir trendDir) { if (dowPivot.ShowTargetAndStop) { // Set where will be drawn the finish target line const int endLine = -4; switch (trendDir) { case TrendDir.Down: double nDown = pp.SecondHigh.Price - pp.FirstLow.Price < 0 ? (pp.SecondHigh.Price - pp.FirstLow.Price) * -1 : pp.SecondHigh.Price - pp.FirstLow.Price; double downTarget = (dowPivot.PercentProfitTargetFibo / 100) * nDown; downTarget -= pp.SecondHigh.Price; downTarget *= -1; // Inverte valor negativo para positivo Draw.Line(dowPivot, dowPivot.CurrentBar.ToString(), false, Miscellaneous.ConvertBarIndexToBarsAgo(dowPivot, pp.FirstLow.BarIndex), downTarget, endLine, downTarget, Brushes.Red, DashStyleHelper.Solid, 2); dowPivot.ProfitTargetPriceSignal[0] = downTarget; break; case TrendDir.Up: double nUp = pp.SecondLow.Price - pp.FirstHigh.Price < 0 ? (pp.SecondLow.Price - pp.FirstHigh.Price) * -1 : pp.SecondLow.Price - pp.FirstHigh.Price; double upTarget = (dowPivot.PercentProfitTargetFibo / 100) * nUp; upTarget += pp.SecondLow.Price; Draw.Line(dowPivot, dowPivot.CurrentBar.ToString(), false, Miscellaneous.ConvertBarIndexToBarsAgo(dowPivot, pp.FirstHigh.BarIndex), upTarget, endLine, upTarget, Brushes.Green, DashStyleHelper.Solid, 2); dowPivot.ProfitTargetPriceSignal[0] = upTarget; break; case TrendDir.Unknown: dowPivot.ProfitTargetPriceSignal[0] = dowPivot.Input[0]; break; } } }
private void PrintPivots(DowPivotOld dowPivot, Situation state) { line1 = "Line 1 " + dowPivot.CurrentBar; line2 = "Line 2 " + dowPivot.CurrentBar; switch (state) { case Situation.AddHigh: lastHighLegTagLine3 = "Line 3 " + dowPivot.CurrentBar; Draw.Line(dowPivot, line1, false, Miscellaneous.ConvertBarIndexToBarsAgo(dowPivot, high.FirstLow.BarIndex), high.FirstLow.Price, Miscellaneous.ConvertBarIndexToBarsAgo(dowPivot, high.FirstHigh.BarIndex), high.FirstHigh.Price, Brushes.Green, DashStyleHelper.Solid, dowPivot.DrawProp.ZigZagWidth); Draw.Line(dowPivot, line2, false, Miscellaneous.ConvertBarIndexToBarsAgo(dowPivot, high.FirstHigh.BarIndex), high.FirstHigh.Price, Miscellaneous.ConvertBarIndexToBarsAgo(dowPivot, high.SecondLow.BarIndex), high.SecondLow.Price, Brushes.Green, DashStyleHelper.Solid, dowPivot.DrawProp.ZigZagWidth); Draw.Line(dowPivot, lastHighLegTagLine3, false, Miscellaneous.ConvertBarIndexToBarsAgo(dowPivot, high.SecondLow.BarIndex), high.SecondLow.Price, Miscellaneous.ConvertBarIndexToBarsAgo(dowPivot, high.SecondHigh.BarIndex), high.SecondHigh.Price, Brushes.Green, DashStyleHelper.Solid, dowPivot.DrawProp.ZigZagWidth); break; case Situation.AddLow: lastLowLegTagLine3 = "Line 3 " + dowPivot.CurrentBar; Draw.Line(dowPivot, line1, false, Miscellaneous.ConvertBarIndexToBarsAgo(dowPivot, low.FirstHigh.BarIndex), low.FirstHigh.Price, Miscellaneous.ConvertBarIndexToBarsAgo(dowPivot, low.FirstLow.BarIndex), low.FirstLow.Price, Brushes.Red, DashStyleHelper.Solid, dowPivot.DrawProp.ZigZagWidth); Draw.Line(dowPivot, line2, false, Miscellaneous.ConvertBarIndexToBarsAgo(dowPivot, low.FirstLow.BarIndex), low.FirstLow.Price, Miscellaneous.ConvertBarIndexToBarsAgo(dowPivot, low.SecondHigh.BarIndex), low.SecondHigh.Price, Brushes.Red, DashStyleHelper.Solid, dowPivot.DrawProp.ZigZagWidth); Draw.Line(dowPivot, lastLowLegTagLine3, false, Miscellaneous.ConvertBarIndexToBarsAgo(dowPivot, low.SecondHigh.BarIndex), low.SecondHigh.Price, Miscellaneous.ConvertBarIndexToBarsAgo(dowPivot, low.SecondLow.BarIndex), low.SecondLow.Price, Brushes.Red, DashStyleHelper.Solid, dowPivot.DrawProp.ZigZagWidth); break; case Situation.UpdateHigh: Draw.Line(dowPivot, lastHighLegTagLine3, false, Miscellaneous.ConvertBarIndexToBarsAgo(dowPivot, high.SecondLow.BarIndex), high.SecondLow.Price, Miscellaneous.ConvertBarIndexToBarsAgo(dowPivot, high.SecondHigh.BarIndex), high.SecondHigh.Price, Brushes.Green, DashStyleHelper.Solid, dowPivot.DrawProp.ZigZagWidth); break; case Situation.UpdateLow: Draw.Line(dowPivot, lastLowLegTagLine3, false, Miscellaneous.ConvertBarIndexToBarsAgo(dowPivot, low.SecondHigh.BarIndex), low.SecondHigh.Price, Miscellaneous.ConvertBarIndexToBarsAgo(dowPivot, low.SecondLow.BarIndex), low.SecondLow.Price, Brushes.Red, DashStyleHelper.Solid, dowPivot.DrawProp.ZigZagWidth); break; } }
private void PrintZigZagLines(DowPivotOld dowPivot, Situation situation) { if (lows.Count != 0 && highs.Count != 0 && dowPivot.DrawProp.ShowZigZag) { switch (situation) { case Situation.AddLow: lowTagName = "Low line" + dowPivot.CurrentBar; Draw.Line(dowPivot, lowTagName, false, Miscellaneous.ConvertBarIndexToBarsAgo(dowPivot, GetHigh(0).BarIndex), GetHigh(0).Price, Miscellaneous.ConvertBarIndexToBarsAgo(dowPivot, GetLow(0).BarIndex), GetLow(0).Price, dowPivot.DrawProp.ZigZagColor, DashStyleHelper.Solid, dowPivot.DrawProp.ZigZagWidth); break; case Situation.AddHigh: highTagName = "High line" + dowPivot.CurrentBar; Draw.Line(dowPivot, highTagName, false, Miscellaneous.ConvertBarIndexToBarsAgo(dowPivot, GetLow(0).BarIndex), GetLow(0).Price, Miscellaneous.ConvertBarIndexToBarsAgo(dowPivot, GetHigh(0).BarIndex), GetHigh(0).Price, dowPivot.DrawProp.ZigZagColor, DashStyleHelper.Solid, dowPivot.DrawProp.ZigZagWidth); break; case Situation.UpdateLow: Draw.Line(dowPivot, lowTagName, false, Miscellaneous.ConvertBarIndexToBarsAgo(dowPivot, GetHigh(0).BarIndex), GetHigh(0).Price, Miscellaneous.ConvertBarIndexToBarsAgo(dowPivot, GetLow(0).BarIndex), GetLow(0).Price, dowPivot.DrawProp.ZigZagColor, DashStyleHelper.Solid, dowPivot.DrawProp.ZigZagWidth); break; case Situation.UpdateHigh: Draw.Line(dowPivot, highTagName, false, Miscellaneous.ConvertBarIndexToBarsAgo(dowPivot, GetLow(0).BarIndex), GetLow(0).Price, Miscellaneous.ConvertBarIndexToBarsAgo(dowPivot, GetHigh(0).BarIndex), GetHigh(0).Price, dowPivot.DrawProp.ZigZagColor, DashStyleHelper.Solid, dowPivot.DrawProp.ZigZagWidth); break; } } }