public void SetConfigExtend( U50Extend extend ) { m_ConfigEControlSub1.CheckBoxAllow.Checked = extend.Info01.Enabled; if ( extend.Info01.Select == U50ExtendInfo01Type.Any ) { m_ConfigEControlSub1.RadioButtonAny.Checked = true; } else if ( extend.Info01.Select == U50ExtendInfo01Type.High ) { m_ConfigEControlSub1.RadioButtonHigh.Checked = true; } else if ( extend.Info01.Select == U50ExtendInfo01Type.HighNumber ) { m_ConfigEControlSub1.RadioButtonHighNow.Checked = true; } m_ConfigEControlSub1.NumericUpDownKLine.Value = extend.Info01.HighNumber; m_ConfigEControlSub1.TrackBarKLine.Value = extend.Info01.HighNumber; // m_ConfigEControlSub2.CheckBoxAllow.Checked = extend.Info02.Enabled; if ( extend.Info02.Select == U50SelectType.Any ) { m_ConfigEControlSub2.RadioButtonAny.Checked = true; } else if ( extend.Info02.Select == U50SelectType.Big ) { m_ConfigEControlSub2.RadioButtonBig.Checked = true; } else if ( extend.Info02.Select == U50SelectType.BigAndSmall ) { m_ConfigEControlSub2.RadioButtonBigAndSmall.Checked = true; } else if ( extend.Info02.Select == U50SelectType.Small ) { m_ConfigEControlSub2.RadioButtonSmall.Checked = true; } m_ConfigEControlSub2.MaskedTextBoxBig.Text = extend.Info02.Big.ToString( "0000000000" ); m_ConfigEControlSub2.MaskedTextBoxBig2.Text = extend.Info02.Big2.ToString( "0000000000" ); m_ConfigEControlSub2.MaskedTextBoxSmall.Text = extend.Info02.Small.ToString( "0000000000" ); m_ConfigEControlSub2.MaskedTextBoxSmall2.Text = extend.Info02.Small2.ToString( "0000000000" ); // m_ConfigEControlSub3.CheckBoxAllow.Checked = extend.Info03.Enabled; if ( extend.Info03.Select == U50SelectType.Any ) { m_ConfigEControlSub3.RadioButtonAny.Checked = true; } else if ( extend.Info03.Select == U50SelectType.Big ) { m_ConfigEControlSub3.RadioButtonBig.Checked = true; } else if ( extend.Info03.Select == U50SelectType.BigAndSmall ) { m_ConfigEControlSub3.RadioButtonBigAndSmall.Checked = true; } else if ( extend.Info03.Select == U50SelectType.Small ) { m_ConfigEControlSub3.RadioButtonSmall.Checked = true; } m_ConfigEControlSub3.MaskedTextBoxBig.Text = extend.Info03.Big.ToString( "0000" ); m_ConfigEControlSub3.MaskedTextBoxBig2.Text = extend.Info03.Big2.ToString( "0000" ); m_ConfigEControlSub3.MaskedTextBoxSmall.Text = extend.Info03.Small.ToString( "0000" ); m_ConfigEControlSub3.MaskedTextBoxSmall2.Text = extend.Info03.Small2.ToString( "0000" ); // m_ConfigEControlSub4.CheckBoxAllow.Checked = extend.Info04.Enabled; if ( extend.Info04.Select == U50ExtendInfo04Type.Any ) { m_ConfigEControlSub4.RadioButtonAny.Checked = true; } else if ( extend.Info04.Select == U50ExtendInfo04Type.Yes ) { m_ConfigEControlSub4.RadioButtonYes.Checked = true; } else if ( extend.Info04.Select == U50ExtendInfo04Type.No ) { m_ConfigEControlSub4.RadioButtonNo.Checked = true; } // m_ConfigEControlSub5.CheckBoxAllow.Checked = extend.Info05.Enabled; if ( extend.Info05.Select == U50SelectType.Any ) { m_ConfigEControlSub5.RadioButtonAny.Checked = true; } else if ( extend.Info05.Select == U50SelectType.Big ) { m_ConfigEControlSub5.RadioButtonBig.Checked = true; } else if ( extend.Info05.Select == U50SelectType.BigAndSmall ) { m_ConfigEControlSub5.RadioButtonBigAndSmall.Checked = true; } else if ( extend.Info05.Select == U50SelectType.Small ) { m_ConfigEControlSub5.RadioButtonSmall.Checked = true; } m_ConfigEControlSub5.MaskedTextBoxBig.Text = extend.Info05.Big.ToString( "00000" ); m_ConfigEControlSub5.MaskedTextBoxBig2.Text = extend.Info05.Big2.ToString( "00000" ); m_ConfigEControlSub5.MaskedTextBoxSmall.Text = extend.Info05.Small.ToString( "00000" ); m_ConfigEControlSub5.MaskedTextBoxSmall2.Text = extend.Info05.Small2.ToString( "00000" ); }
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; }
public U50Extend GetConfigExtend() { U50Extend extend = new U50Extend(); extend.Info01.Enabled = m_ConfigEControlSub1.CheckBoxAllow.Checked; if ( m_ConfigEControlSub1.RadioButtonAny.Checked == true ) { extend.Info01.Select = U50ExtendInfo01Type.Any; } else if ( m_ConfigEControlSub1.RadioButtonHigh.Checked == true ) { extend.Info01.Select = U50ExtendInfo01Type.High; } else if ( m_ConfigEControlSub1.RadioButtonHighNow.Checked == true ) { extend.Info01.Select = U50ExtendInfo01Type.HighNumber; } extend.Info01.HighNumber = (int)m_ConfigEControlSub1.NumericUpDownKLine.Value; // extend.Info02.Enabled = m_ConfigEControlSub2.CheckBoxAllow.Checked; if ( m_ConfigEControlSub2.RadioButtonAny.Checked == true ) { extend.Info02.Select = U50SelectType.Any; } else if ( m_ConfigEControlSub2.RadioButtonBig.Checked == true ) { extend.Info02.Select = U50SelectType.Big; } else if ( m_ConfigEControlSub2.RadioButtonBigAndSmall.Checked == true ) { extend.Info02.Select = U50SelectType.BigAndSmall; } else if ( m_ConfigEControlSub2.RadioButtonSmall.Checked == true ) { extend.Info02.Select = U50SelectType.Small; } extend.Info02.Big = long.Parse( m_ConfigEControlSub2.MaskedTextBoxBig.Text ); extend.Info02.Big2 = long.Parse( m_ConfigEControlSub2.MaskedTextBoxBig2.Text ); extend.Info02.Small = long.Parse( m_ConfigEControlSub2.MaskedTextBoxSmall.Text ); extend.Info02.Small2 = long.Parse( m_ConfigEControlSub2.MaskedTextBoxSmall2.Text ); // extend.Info03.Enabled = m_ConfigEControlSub3.CheckBoxAllow.Checked; if ( m_ConfigEControlSub3.RadioButtonAny.Checked == true ) { extend.Info03.Select = U50SelectType.Any; } else if ( m_ConfigEControlSub3.RadioButtonBig.Checked == true ) { extend.Info03.Select = U50SelectType.Big; } else if ( m_ConfigEControlSub3.RadioButtonBigAndSmall.Checked == true ) { extend.Info03.Select = U50SelectType.BigAndSmall; } else if ( m_ConfigEControlSub3.RadioButtonSmall.Checked == true ) { extend.Info03.Select = U50SelectType.Small; } extend.Info03.Big = int.Parse( m_ConfigEControlSub3.MaskedTextBoxBig.Text ); extend.Info03.Big2 = int.Parse( m_ConfigEControlSub3.MaskedTextBoxBig2.Text ); extend.Info03.Small = int.Parse( m_ConfigEControlSub3.MaskedTextBoxSmall.Text ); extend.Info03.Small2 = int.Parse( m_ConfigEControlSub3.MaskedTextBoxSmall2.Text ); // extend.Info04.Enabled = m_ConfigEControlSub4.CheckBoxAllow.Checked; if ( m_ConfigEControlSub4.RadioButtonAny.Checked == true ) { extend.Info04.Select = U50ExtendInfo04Type.Any; } else if ( m_ConfigEControlSub4.RadioButtonYes.Checked == true ) { extend.Info04.Select = U50ExtendInfo04Type.Yes; } else if ( m_ConfigEControlSub4.RadioButtonNo.Checked == true ) { extend.Info04.Select = U50ExtendInfo04Type.No; } // extend.Info05.Enabled = m_ConfigEControlSub5.CheckBoxAllow.Checked; if ( m_ConfigEControlSub5.RadioButtonAny.Checked == true ) { extend.Info05.Select = U50SelectType.Any; } else if ( m_ConfigEControlSub5.RadioButtonBig.Checked == true ) { extend.Info05.Select = U50SelectType.Big; } else if ( m_ConfigEControlSub5.RadioButtonBigAndSmall.Checked == true ) { extend.Info05.Select = U50SelectType.BigAndSmall; } else if ( m_ConfigEControlSub5.RadioButtonSmall.Checked == true ) { extend.Info05.Select = U50SelectType.Small; } extend.Info05.Big = int.Parse( m_ConfigEControlSub5.MaskedTextBoxBig.Text ); extend.Info05.Big2 = int.Parse( m_ConfigEControlSub5.MaskedTextBoxBig2.Text ); extend.Info05.Small = int.Parse( m_ConfigEControlSub5.MaskedTextBoxSmall.Text ); extend.Info05.Small2 = int.Parse( m_ConfigEControlSub5.MaskedTextBoxSmall2.Text ); return extend; }