Пример #1
0
        public void DrawAccount()
        {
            IStrategyTrader trader = this.StrategyHelper.Trader;

            if (trader == null || trader.Account == null)
            {
                return;
            }
            if (MainKLinePeriod == null || mainKlineData == null)
            {
                return;
            }
            IStrategyDrawer_PriceRect drawer = StrategyHelper.Drawer.GetDrawer_KLine(MainKLinePeriod);
            IList <TradeInfo>         trades = trader.Account.CurrentTradeInfo;

            for (int i = 0; i < trades.Count; i++)
            {
                TradeInfo trade = trades[i];
                float     price = (float)trade.Price;
                Color     color = trade.Side == OrderSide.Sell ? Color.Green : Color.Red;
                // trade.Time;
                int barPos = FindMainBarPos(trade.Time);
                drawer.DrawPoint(new graphic.shape.PriceShape_Point(barPos, price, 8, color));
            }
        }
Пример #2
0
        public override void OnEnd(Object sender, IStrategyOnEndArgument argument)
        {
            IStrategyDrawer_PriceRect drawHelper = StrategyHelper.Drawer.GetDrawer_KLine(MainKLinePeriod);

            ZigzagDrawer.DrawZigzagPoints(drawHelper, this.zigzag.GetPoints(), Color.Blue, Color.White, 8);
            ZigzagDrawer.DrawZigzagPoints(drawHelper, this.zigzag.GetMergedPoints(), 12);
            //DrawZigzagPoints(drawHelper, this.zigzag.GetMergedPoints(), 12);
        }
Пример #3
0
        public override void OnEnd(Object sender, IStrategyOnEndArgument argument)
        {
            IStrategyDrawer_PriceRect drawHelper = StrategyHelper.Drawer.GetDrawer_KLine(MainKLinePeriod);

            //drawHelper.DrawRect()
            //drawHelper.DrawPolyLine(maArr_1, color_1);
            //drawHelper.DrawTitle(1, "MA组合(" + Param_1 + "," + Param_2 + "," + Param_3 + "," + Param_4 + "," + Param_5 + ")", color_2);
        }
Пример #4
0
 public static void DrawZigzagPoints(IStrategyDrawer_PriceRect drawHelper, List <ZigzagPoint> points, Color colorHigh, Color colorLow, int width)
 {
     for (int i = 0; i < points.Count; i++)
     {
         ZigzagPoint point = points[i];
         float       price = point.IsHigh ? point.GetBar().High : point.GetBar().Low;
         Color       color = point.IsHigh ? colorHigh : colorLow;
         drawHelper.DrawPoint(new graphic.shape.PriceShape_Point(point.BarPos, price, width, color));
     }
 }
Пример #5
0
        public override void OnEnd(object sender, IStrategyOnEndArgument argument)
        {
            DrawAccount();
            IStrategyDrawer_PriceRect drawHelper = StrategyHelper.Drawer.GetDrawer_KLine(MainKLinePeriod);
            List <float> ma10 = referedStrategy_MA10.MAList;
            List <float> ma20 = referedStrategy_MA20.MAList;

            drawHelper.DrawPolyLine(ma10, color_1);
            drawHelper.DrawPolyLine(ma20, color_2);
            //drawHelper.DrawTitle(1, "MA组合(" + Param_1 + "," + Param_2 + "," + Param_3 + "," + Param_4 + "," + Param_5 + ")", color_2);
        }
Пример #6
0
 public void Save(XmlElement xmlElem)
 {
     foreach (KLinePeriod klinePeriod in dic_KLinePeriod_Drawer.Keys)
     {
         IStrategyDrawer_PriceRect drawer = dic_KLinePeriod_Drawer[klinePeriod];
         XmlElement elemDrawer            = xmlElem.OwnerDocument.CreateElement("drawer");
         klinePeriod.Save(elemDrawer);
         //elemDrawer.SetAttribute("klineperiod", klinePeriod.ToString());
         xmlElem.AppendChild(elemDrawer);
         drawer.Save(elemDrawer);
     }
 }
Пример #7
0
        private void DrawPlatform(Platform platform, IStrategyDrawer_PriceRect drawHelper)
        {
            PriceShape_Rect priceRect = new PriceShape_Rect();

            priceRect.PriceLeft   = platform.StartIndex;
            priceRect.PriceTop    = platform.TopList[2].KLineBar.High;
            priceRect.PriceRight  = platform.EndIndex;
            priceRect.PriceBottom = platform.BottomList[2].KLineBar.Low;
            priceRect.Color       = System.Drawing.Color.Red;
            //priceRect.FillRect = true;
            drawHelper.DrawRect(priceRect);
        }
Пример #8
0
        public void Refresh()
        {
            ChartComponentData compData  = this.compChart.Controller.ChartComponentData;
            ChartType          chartType = compData.ChartType;

            if (chartType == ChartType.KLine)
            {
                IStrategyDrawer_PriceRect drawer = drawOperator.GetDrawer_KLine(compData.KlinePeriod);
                drawer.Refresh();
            }
            //else if (chartType == ChartType.TimeLine)
            //    drawOperator.GetDrawer_TimeLine().Refresh();
            //else if (chartType == ChartType.Tick)
            //    drawOperator.GetDrawer_Tick().Refresh();
        }
Пример #9
0
        public override void OnEnd(object sender, IStrategyOnEndArgument argument)
        {
            IStrategyDrawer_PriceRect drawHelper = StrategyHelper.Drawer.GetDrawer_KLine(period);
            StrategyArray <double>    arr        = looper_ma.GetMaData(MaPeriod).Data;
            List <float> ff = new List <float>();

            for (int i = 0; i < arr.Count; i++)
            {
                ff.Add((float)arr[i]);
            }
            drawHelper.DrawPolyLine(ff, System.Drawing.Color.Green);

            for (int i = 0; i < platForms.Count; i++)
            {
                Platform platform = platForms[i];
                DrawPlatform(platform, drawHelper);
            }

            StrategyHelper.QueryResultManager.AddQueryResult(new StrategyQueryResult_Platform(platForms));
        }
Пример #10
0
        public override void OnBar(object sender, IStrategyOnBarArgument currentData)
        {
            if (isOpen)
            {
                return;
            }
            IStrategyOnBarInfo barInfo    = currentData.MainBar;
            IKLineBar          currentBar = barInfo.KLineBar;
            IKLineBar          lastBar    = barInfo.KLineData.GetBar(barInfo.BarPos - 1);

            //多头吞噬
            if (currentBar.BlockHigh > lastBar.BlockHigh &&
                currentBar.BlockLow < lastBar.BlockLow &&
                currentBar.isRed() &&
                currentBar.BlockHeight >= 20)
            {
                openPrice = currentBar.End;
                StrategyHelper.Trader.Open(currentData.Code, data.market.OrderSide.Buy, openPrice, 10);
                isOpen = true;
                strategyResult.AddRow(currentBar.Code, barInfo.KLineBar.Time, new object[] { currentBar.BlockHeight, lastBar.BlockHeight });
                IStrategyDrawer_PriceRect drawer = StrategyHelper.Drawer.GetDrawer_KLine(barInfo.KLinePeriod);
                drawer.DrawPoint(new graphic.shape.PriceShape_Point(barInfo.BarPos, openPrice));
            }
        }
Пример #11
0
 public static void DrawZigzagPoints(IStrategyDrawer_PriceRect drawHelper, List <ZigzagPoint> points, int width)
 {
     DrawZigzagPoints(drawHelper, points, Color.Red, Color.Green, width);
 }