public void drawTarget(IBars bars, int curbar) { if (this.DrawLinesOnChart && curbar == PopGunTriggerBar) { AddChartText(("PopGunSize" + curbar), (Math.Round((((bars[0].High - bars[0].Low) / bars[0].Close) * 100), 2)).ToString(), 0, bars.GetByIndex(PopGunTriggerBar).Low - TickSize * bars[0].Close, Color.Black); } if (curbar <= PopGunTarget && curbar > PopGunTriggerBar && curbar > 0) { DateTime lineend = GlobalUtilities.GetTargetBar(bars, bars.GetByIndex(PopGunTriggerBar).Time, TimeFrame, PopGunExpires); if (this.DrawLinesOnChart) { string strPopGunLong = "PopGunLong" + curbar; string strPopGunShort = "PopGunShort" + curbar; AddChartLine(strPopGunLong, true, bars.GetByIndex(PopGunTriggerBar).Time, PopGunTriggerLong, lineend, PopGunTriggerLong, Color.Green, Const.DefaultIndicatorDashStyle, Const.DefaultLineWidth_large); AddChartLine(strPopGunShort, true, bars.GetByIndex(PopGunTriggerBar).Time, PopGunTriggerShort, lineend, PopGunTriggerShort, Color.Red, Const.DefaultIndicatorDashStyle, Const.DefaultLineWidth_large); } if (this.IsSnapshotActive && curbar == PopGunTarget) { GlobalUtilities.SaveSnapShot("PopGun", bars.Instrument.Name, this.Root.Core.ChartManager.AllCharts, bars, TimeFrame); } } }
public void drawTarget() { if (CurrentBar <= PopGunTarget && CurrentBar > PopGunTriggerBar && CurrentBar > 0) { string strPopGunLong = "PopGunLong" + CurrentBar; string strPopGunShort = "PopGunShort" + CurrentBar; DateTime lineend = GlobalUtilities.GetTargetBar(Bars, Bars.GetByIndex(PopGunTriggerBar).Time, TimeFrame, PopGunExpires); DrawLine(strPopGunLong, true, Bars.GetByIndex(PopGunTriggerBar).Time, PopGunTriggerLong, lineend, PopGunTriggerLong, Color.Green, Const.DefaultIndicatorDashStyle, Const.DefaultLineWidth_large); DrawLine(strPopGunShort, true, Bars.GetByIndex(PopGunTriggerBar).Time, PopGunTriggerShort, lineend, PopGunTriggerShort, Color.Red, Const.DefaultIndicatorDashStyle, Const.DefaultLineWidth_large); if (this.IsSnapshotActive && CurrentBar == PopGunTarget) { GlobalUtilities.SaveSnapShot("PopGun", Instrument.Name, this.Root.Core.ChartManager.AllCharts, Bars, TimeFrame); } } }
public void process_ShowGap() { //Prüfen, ob 15min Chart aktiviert ist, anonsten -> raus if (Bars != null && Bars.Count > 0 && TimeFrame.Periodicity == DatafeedHistoryPeriodicity.Minute && TimeFrame.PeriodicityValue == 15) { } else { return; } //Prüfen, ob es sich um die erste Kerze des Tage handelt, nur mit dieser kann Gap berechnet werden if (Bars.BarsCountForSession == 0) { sessionprocessed = false; } //Marktöffnungszeit für Instrument lesen TimeSpan openingtime = GlobalUtilities.GetOfficialMarketOpeningTime(Instrument.Symbol); //Prüfen, ob aktuelle Kerze nach der offiziellen Marktöffnung ist, oder ob es eine vorbörsliche Kerze ist if (Bars.GetTime(ProcessingBarIndex).TimeOfDay > openingtime && //größer 09.00 geht für 15M und 1Std (und 1Tag?) sessionprocessed == false) //Tag noch nicht verarbeitet { sessionprocessed = true; GapTradeLong = GapTradeShort = false; //Erste Kerze des Tages besorgen und deren Errönfnungskurs lesen IBar GapOpenBar = GlobalUtilities.GetFirstBarOfCurrentSession(Bars, Bars[0].Time.Date); GapOpen = GapOpenBar.Open; //Tagesschlusskurs von gestern besorgen double LastDayClose = PriorDayOHLC(Closes[0]).PriorClose[0]; //Wenn es keinen LastDayClose Wert gibt -> raus (immer am Anfang des Charts) if (LastDayClose == 0) { return; } PunkteGapMax = (decimal)LastDayClose * _PunkteGapMaxProz; PunkteGapMin = (decimal)LastDayClose * _PunkteGapMinProz; //gestrige Schlusskurs soll auch als InitialStop für etwaige Orders verwendet werden StopForShowGapTrade = LastDayClose; //Gapgröße berechnen GapSize = GapOpen - LastDayClose; //DateTime von gestrigen Schlusskurs IBar GapCloseBar = GlobalUtilities.GetLastBarOfLastSession(Bars, Bars[0].Time.Date); DateTime LastDayCloseDate = GapCloseBar.Time; DateTime LastPeriod = Time[1]; //Prüfen ob es überhaupt ein Gap gab if (LastDayClose > 0 && Math.Abs(GapSize) > 0) { existgap = true; //Gap markieren (08.00 - 09.15) string strMyRect = "MyRect" + Count; string strMyGapSize = "MyGapSize" + Count; //Gap zeigt nach oben if (IsUpwardsGap() == true) { //Long AddChartRectangle(strMyRect, true, LastDayCloseDate, LastDayClose, LastPeriod, GlobalUtilities.GetHighestHigh(Bars, Bars.BarsCountForSession), _col_gap, _col_gap, 70); AddChartText(strMyGapSize, true, Math.Round(GapSize, 1).ToString(), GapOpenBar.Time, LastDayClose - (60 * TickSize), 9, Color.Black, new Font("Arial", 9), StringAlignment.Center, Color.Black, Color.Azure, 1); if (GapIndicatesTradeLong() == true) { //Chancenreicher SuccessTrade Long PrepareTradeLong(); } } //Gap zeigt nach unten else { //Short AddChartRectangle(strMyRect, true, LastDayCloseDate, LastDayClose, LastPeriod, GlobalUtilities.GetLowestLow(Bars, Bars.BarsCountForSession), _col_gap, _col_gap, 70); AddChartText(strMyGapSize, true, Math.Round(GapSize, 1).ToString(), GapOpenBar.Time, LastDayClose + (60 * TickSize), 9, Color.Black, new Font("Arial", 9), StringAlignment.Center, Color.Black, Color.Azure, 1); if (GapIndicatesTradeShort() == true) { ////Chancenreicher SuccessTrade Short PrepareTradeShort(); } } if (GapTradeShort == true || GapTradeLong == true) { //Auswertung PrintBasicTradeInfo(); } } else { existgap = false; } } //09.15. - 09.30 Kerze // else if (Bars.BarsCountForSession == 6 && existgap == true) else if (Bars[0].Time.TimeOfDay == new TimeSpan(9, 15, 0)) { //Auswertung nach ShowGap Handelszeit (=09.30) printAuswertung(); GlobalUtilities.SaveSnapShot("ShowGap", Instrument.Name, this.Root.Core.ChartManager.AllCharts, Bars, TimeFrame); } }