public override void Update(TickStatus args) { if (args != TickStatus.IsQuote) { ci.Insert(0, 0); hlc3.Insert(0, 0); absD.Insert(0, 0); hlc3[0] = HLC3(0); absD[0] = Math.Abs(HLC3(0) - esa.GetValue(0)); ci[0] = CI(0); EMA(0, ci, AveragePeriod); Lines[0].SetValue(ci[0]); Lines[1].SetValue(wt2.GetValue()); Clouds[0].Set(ci[0] - wt2.GetValue(), 0.0001); if (Lines[0].GetValue() < Lines[1].GetValue() && Lines[0].GetValue(1) >= Lines[1].GetValue(1) && Lines[0].GetValue() > Thresholds[0].Level) { BarStamps.Set(new BarStampPrimitiveFigure(Color.Red, 0, Lines[0].GetValue(), PrimitiveFigure.TriangleDown)); } if (Lines[0].GetValue() > Lines[1].GetValue() && Lines[0].GetValue(1) <= Lines[1].GetValue(1) && Lines[0].GetValue() < Thresholds[2].Level) { BarStamps.Set(new BarStampPrimitiveFigure(Color.LimeGreen, 0, Lines[0].GetValue(), PrimitiveFigure.TriangleUp)); } } }
/// <summary> /// Entry point. This function is called when new quote comes or new bar created /// </summary> public override void Update(TickStatus args) { if (HistoryDataSeries.Count < 80) { return; } if (args != TickStatus.IsQuote) { patternFormation = new List <PatternFormation>(); patternFormation.Add(new PatternFormation(cdlKeyReversal(), Lines["cdlKeyReversalDown"].Color)); patternFormation.Add(new PatternFormation(cdl3DayCompression(), Lines["cdl3DayCompression"].Color)); patternFormation.Add(new PatternFormation(cdlIslandReversal(), Lines["cdlIslandReversal"].Color)); patternFormation.Add(new PatternFormation(cdlOutsideDay(), Lines["cdlOutsideDay"].Color)); patternFormation.Add(new PatternFormation(cdlWideRangeDays(), Lines["cdlWideRangeDays"].Color)); patternFormation.Add(new PatternFormation(cdlGapOpening(), Lines["cdlGapOpening"].Color)); var lastFormation = patternFormation.Where(x => x.Direction != TradeDirection.None).LastOrDefault(); var value = lastFormation.Direction == TradeDirection.Buy ? GetLow(1) - HistoryDataSeries.HistoricalRequest.Instrument.MinimalTickSize * 100D : GetHigh(1) + HistoryDataSeries.HistoricalRequest.Instrument.MinimalTickSize * 100D; var figure = lastFormation.Direction == TradeDirection.Buy ? PrimitiveFigure.TriangleUp : PrimitiveFigure.TriangleDown; BarStamps.Set(new BarStampPrimitiveFigure(lastFormation.Color, 1, value, figure)); } }
private void drawBarStamp(string text, Color color, PrimitiveFigure primitiveFigure, bool up = false, double offset = 1) { var tickSize = HistoryDataSeries.HistoricalRequest.Instrument.MinimalTickSize; offset = offset * tickSize; BarStamps.Set(new BarStampPrimitiveFigure(color, 0, up? High() + mfiOffsetPrimitive + offset : Low() - mfiOffsetPrimitive - offset, primitiveFigure)); BarStamps.Set(new BarStampText(text, new Font("Arial", 10), color, Color.Transparent, 0, up? High() + mfiOffsetText + offset + 3 * tickSize : Low() - mfiOffsetText - offset - 10 * tickSize)); }
private void DrawBarStamp(Color color, PrimitiveFigure primitiveFigure, bool up = false, double offset = 1) { var tickSize = HistoryDataSeries.HistoricalRequest.Instrument.MinimalTickSize; offset = offset * tickSize; BarStamps.Set(new BarStampPrimitiveFigure(color, 0, up ? HistoryDataSeries.GetValue(PriceType.High) + offsetPrimitive + offset : HistoryDataSeries.GetValue(PriceType.Low) - offsetPrimitive - offset, primitiveFigure)); }