Пример #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 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));
     }
 }
Пример #3
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));
            }
        }