public static bool IsPassGeneral( StockData[] stockDataArray, Demo.Stock.X.Common.StockInfo stockInfo, U50Filtrate filtrateInfo, U50Extend extendInfo, ref U50ReportSub reportSub ) { if ( stockDataArray == null ) return false; if ( stockDataArray.Length < 3 ) return false; // IsPassGeneral int iSKn = 1; int iH1Kn = GetStockInfoHighReturnKN( stockDataArray ); if ( iH1Kn <= iSKn ) // iH1Kn > iSKn return false; int iL1Kn = GetStockInfoLowReturnKN( stockDataArray ); if ( iL1Kn < iH1Kn ) // iL1Kn >= iH1Kn return false; int iL2Kn = GetStockInfoLow2ReturnKN( stockDataArray, iH1Kn - 1 ); if ( iL2Kn < iSKn ) // iL2Kn >= iSKn return false; if ( iL2Kn >= iH1Kn ) // iL2Kn < iH1Kn return false; StockData stockDataS = stockDataArray[0]; StockData stockDataH1 = stockDataArray[iH1Kn - 1]; StockData stockDataL1 = stockDataArray[iL1Kn - 1]; StockData stockDataL2 = stockDataArray[iL2Kn - 1]; if ( stockDataL1.MinimumPrice >= stockDataL2.MinimumPrice ) return false; if ( stockDataL1.MinimumPrice >= stockDataH1.HighestPrice ) return false; if ( stockDataL1.MinimumPrice >= stockDataS.HighestPrice ) return false; if ( stockDataL2.MinimumPrice >= stockDataH1.HighestPrice ) return false; if ( stockDataL2.MinimumPrice >= stockDataS.HighestPrice ) return false; if ( stockDataS.HighestPrice >= stockDataH1.HighestPrice ) { float fRatio = ( stockDataS.HighestPrice - stockDataH1.HighestPrice ) / ( stockDataS.HighestPrice - stockDataL2.MinimumPrice ); if ( fRatio >= 0.5 ) return false; } // IsPassFiltrate float fP_Up = stockDataH1.HighestPrice - stockDataL1.MinimumPrice; // 主升浪价格幅度 float fP_Down = stockDataH1.HighestPrice - stockDataL2.MinimumPrice; // 下跌浪价格幅度 float fP_Con = stockDataS.HighestPrice - stockDataL2.MinimumPrice; // 盘整浪价格幅度 int iKn_Up = iL1Kn - iH1Kn + 1; // 主升浪K线总数 int iKn_Down = iH1Kn - iL2Kn + 1; // 下跌浪的K线总数 int iKn_Con = iL2Kn - iSKn + 1; // 盘整浪的K线总数 int iKn_Conf = iH1Kn - iSKn + 1; // 整理区间的K线数量 int iKn_U50 = iL1Kn; // U50形态的总K线数 float fVa_Up = 0F; // 主升浪平均成交量 for ( int i = 0; i < iKn_Up; i++ ) { StockData stockData = stockDataArray[( iH1Kn - 1 ) + i]; fVa_Up += stockData.TradingVolume; } fVa_Up = fVa_Up / iKn_Up; float fVa_Down = 0F; // 下跌浪平均成交量 for ( int i = 0; i < iKn_Down; i++ ) { StockData stockData = stockDataArray[( iL2Kn - 1 ) + i]; fVa_Down += stockData.TradingVolume; } fVa_Down = fVa_Down / iKn_Down; float fVa_Con = 0F; // 盘整浪的平均成交量 for ( int i = 0; i < iKn_Con; i++ ) { StockData stockData = stockDataArray[( iSKn - 1 ) + i]; fVa_Con += stockData.TradingVolume; } fVa_Con = fVa_Con / iKn_Con; float fVa_Conf = 0F; // 整理区间平均成交量 for ( int i = 0; i < iKn_Conf; i++ ) { StockData stockData = stockDataArray[( iSKn - 1 ) + i]; fVa_Conf += stockData.TradingVolume; } fVa_Conf = fVa_Conf / iKn_Conf; float fVa_U50 = 0F; // U50形态平均成交量 for ( int i = 0; i < iKn_U50; i++ ) { StockData stockData = stockDataArray[( iSKn - 1 ) + i]; fVa_U50 += stockData.TradingVolume; } fVa_U50 = fVa_U50 / iKn_U50; // 下面是价格比 float fRatioPDU = ( fP_Down / fP_Up ) * 100; if ( filtrateInfo.PDU.Enabled == true ) { if ( filtrateInfo.PDU.Select == U50SelectType.Big ) { if ( fRatioPDU <= filtrateInfo.PDU.Big ) return false; } else if ( filtrateInfo.PDU.Select == U50SelectType.Small ) { if ( fRatioPDU >= filtrateInfo.PDU.Small ) return false; } else if ( filtrateInfo.PDU.Select == U50SelectType.BigAndSmall ) { if ( fRatioPDU <= filtrateInfo.PDU.Big2 || fRatioPDU >= filtrateInfo.PDU.Small2 ) return false; } } float fRatioPCU = ( fP_Con / fP_Down ) * 100; if ( filtrateInfo.PCU.Enabled == true ) { if ( filtrateInfo.PCU.Select == U50SelectType.Big ) { if ( fRatioPCU <= filtrateInfo.PCU.Big ) return false; } else if ( filtrateInfo.PCU.Select == U50SelectType.Small ) { if ( fRatioPCU >= filtrateInfo.PCU.Small ) return false; } else if ( filtrateInfo.PCU.Select == U50SelectType.BigAndSmall ) { if ( fRatioPCU <= filtrateInfo.PCU.Big2 || fRatioPCU >= filtrateInfo.PCU.Small2 ) return false; } } // 下面是K线比 float fRatioTDU = ( (float)iKn_Down / (float)iKn_Up ) * 100; if ( filtrateInfo.TDU.Enabled == true ) { if ( filtrateInfo.TDU.Select == U50SelectType.Big ) { if ( fRatioTDU <= filtrateInfo.TDU.Big ) return false; } else if ( filtrateInfo.TDU.Select == U50SelectType.Small ) { if ( fRatioTDU >= filtrateInfo.TDU.Small ) return false; } else if ( filtrateInfo.TDU.Select == U50SelectType.BigAndSmall ) { if ( fRatioTDU <= filtrateInfo.TDU.Big2 || fRatioTDU >= filtrateInfo.TDU.Small2 ) return false; } } float fRatioTCD = ( (float)iKn_Con / (float)iKn_Down ) * 100; if ( filtrateInfo.TCD.Enabled == true ) { if ( filtrateInfo.TCD.Select == U50SelectType.Big ) { if ( fRatioTCD <= filtrateInfo.TCD.Big ) return false; } else if ( filtrateInfo.TCD.Select == U50SelectType.Small ) { if ( fRatioTCD >= filtrateInfo.TCD.Small ) return false; } else if ( filtrateInfo.TCD.Select == U50SelectType.BigAndSmall ) { if ( fRatioTCD <= filtrateInfo.TCD.Big2 || fRatioTCD >= filtrateInfo.TCD.Small2 ) return false; } } float fRatioTBU = ( (float)iKn_Conf / (float)iKn_Up ) * 100; if ( filtrateInfo.TBU.Enabled == true ) { if ( filtrateInfo.TBU.Select == U50SelectType.Big ) { if ( fRatioTBU <= filtrateInfo.TBU.Big ) return false; } else if ( filtrateInfo.TBU.Select == U50SelectType.Small ) { if ( fRatioTBU >= filtrateInfo.TBU.Small ) return false; } else if ( filtrateInfo.TBU.Select == U50SelectType.BigAndSmall ) { if ( fRatioTBU <= filtrateInfo.TBU.Big2 || fRatioTBU >= filtrateInfo.TBU.Small2 ) return false; } } // 下面是成交量比 float fRatioVac_UC = ( fVa_Up / fVa_Con ) * 100; if ( filtrateInfo.VacUC.Enabled == true ) { if ( filtrateInfo.VacUC.Select == U50SelectType.Big ) { if ( fRatioVac_UC <= filtrateInfo.VacUC.Big ) return false; } else if ( filtrateInfo.VacUC.Select == U50SelectType.Small ) { if ( fRatioVac_UC >= filtrateInfo.VacUC.Small ) return false; } else if ( filtrateInfo.VacUC.Select == U50SelectType.BigAndSmall ) { if ( fRatioVac_UC <= filtrateInfo.VacUC.Big2 || fRatioVac_UC >= filtrateInfo.VacUC.Small2 ) return false; } } // IsPassExtend // H1的价格数据 if ( extendInfo.Info01.Enabled == true ) { if ( extendInfo.Info01.Select == U50ExtendInfo01Type.High ) { StockData[] stockDataArray2 = stockInfo.GetStockDataRangeByTime( stockDataL1.TradingDate ); foreach ( StockData stockData in stockDataArray2 ) { if ( stockDataH1.HighestPrice <= stockData.HighestPrice ) return false; } } else if ( extendInfo.Info01.Select == U50ExtendInfo01Type.HighNumber ) { StockData[] stockDataArray2 = stockInfo.GetStockDataRangeByKn( stockDataL1.TradingDate, extendInfo.Info01.HighNumber ); foreach ( StockData stockData in stockDataArray2 ) { if ( stockDataH1.HighestPrice <= stockData.HighestPrice ) return false; } } } // U50形态的平均成交量 if ( extendInfo.Info02.Enabled == true ) { if ( extendInfo.Info02.Select == U50SelectType.Big ) { if ( fVa_U50 <= extendInfo.Info02.Big ) return false; } else if ( extendInfo.Info02.Select == U50SelectType.Small ) { if ( fVa_U50 >= extendInfo.Info02.Small ) return false; } else if ( extendInfo.Info02.Select == U50SelectType.BigAndSmall ) { if ( fVa_U50 <= extendInfo.Info02.Big2 || fVa_U50 >= extendInfo.Info02.Small2 ) return false; } } // 当日成交量与U50形态平均成交量比值 if ( extendInfo.Info03.Enabled == true ) { float fVsc = ( stockDataH1.TradingVolume / fVa_U50 ) * 100; if ( extendInfo.Info03.Select == U50SelectType.Big ) { if ( fVsc <= extendInfo.Info03.Big ) return false; } else if ( extendInfo.Info03.Select == U50SelectType.Small ) { if ( fVsc >= extendInfo.Info03.Small ) return false; } else if ( extendInfo.Info03.Select == U50SelectType.BigAndSmall ) { if ( fVsc <= extendInfo.Info03.Big2 || fVsc >= extendInfo.Info03.Small2 ) return false; } } // PS≧PH1? if ( extendInfo.Info04.Enabled == true ) { if ( extendInfo.Info04.Select == U50ExtendInfo04Type.No ) { if ( stockDataS.HighestPrice > stockDataH1.HighestPrice ) // PS <= PH1 return false; } else if ( extendInfo.Info04.Select == U50ExtendInfo04Type.Yes ) { if ( stockDataS.HighestPrice < stockDataH1.HighestPrice ) // PS >= PH1 return false; } } // S点所属K线的收盘价 if ( extendInfo.Info05.Enabled == true ) { if ( extendInfo.Info05.Select == U50SelectType.Big ) { if ( stockDataS.ClosePrice <= extendInfo.Info05.Big ) return false; } else if ( extendInfo.Info05.Select == U50SelectType.Small ) { if ( stockDataS.ClosePrice >= extendInfo.Info05.Small ) return false; } else if ( extendInfo.Info05.Select == U50SelectType.BigAndSmall ) { if ( stockDataS.ClosePrice <= extendInfo.Info05.Big2 || stockDataS.ClosePrice >= extendInfo.Info05.Small2 ) return false; } } reportSub.Q_U50 = 0; reportSub.KLineNumber = iKn_U50; reportSub.Va_U50 = fVa_U50; reportSub.Vsc = stockDataS.TradingVolume; reportSub.Close = stockDataS.ClosePrice; Debug.WriteLine( " " ); Debug.WriteLine( " " ); Debug.WriteLine( " " ); Debug.WriteLine( " --- --- --- --- ---" ); Debug.WriteLine( "StockSymbol: --- " + " stockInfo.StockSymbol = " + stockInfo.StockSymbol ); Debug.WriteLine( "H1TradingDateTime: --- " + " stockDataH1.TradingDateTime = " + stockDataH1.TradingDateTime.ToString() ); Debug.WriteLine( "L1TradingDateTime: --- " + " stockDataL1.TradingDateTime = " + stockDataL1.TradingDateTime.ToString() ); Debug.WriteLine( "L2TradingDateTime: --- " + " stockDataL2.TradingDateTime = " + stockDataL2.TradingDateTime.ToString() ); Debug.WriteLine( "fP_Down: --- " + " stockDataH1.HighestPrice = " + stockDataH1.HighestPrice.ToString() + " stockDataL2.MinimumPrice = " + stockDataL2.MinimumPrice.ToString() ); Debug.WriteLine( "fP_Up: --- " + " stockDataH1.HighestPrice = " + stockDataH1.HighestPrice.ToString() + " stockDataL1.MinimumPrice = " + stockDataL1.MinimumPrice.ToString() ); Debug.WriteLine( "fRatioPDU: --- " + " fP_Down = " + fP_Down.ToString() + " fP_Up = " + fP_Up.ToString() + " fRatioPDU = " + fRatioPDU.ToString() ); Debug.WriteLine( "PDU.Small: --- " + "Select = " + filtrateInfo.PDU.Select.ToString() + " filtrateInfo.PDU.Small = " + filtrateInfo.PDU.Small.ToString() ); Debug.WriteLine( "stockDataS.Close: --- " + "reportSub.Close = " + reportSub.Close.ToString() ); Debug.WriteLine( "Kn_U50: --- " + "reportSub.KLineNumber= " + reportSub.KLineNumber.ToString() ); Debug.WriteLine( " --- --- --- --- ---" ); return true; }