public void AddStockInfo( SRStaticData srStaticData ) { SRStaticData outStaticData = null; if ( m_StaticDataBySymbol.TryGetValue( srStaticData.StockSymbol, out outStaticData ) == true ) return; m_StaticDataBySymbol.Add( srStaticData.StockSymbol, srStaticData ); m_StaticDataArray.Add( srStaticData ); }
public SRStaticData GetStockDataByStockCode(string strSymbol) { SRStaticData outSRStaticData = null; if (m_StaticDataBySymbol.TryGetValue(strSymbol, out outSRStaticData) == true) { return(outSRStaticData); } else { return(null); } }
public void AddStockInfo(SRStaticData srStaticData) { SRStaticData outStaticData = null; if (m_StaticDataBySymbol.TryGetValue(srStaticData.StockSymbol, out outStaticData) == true) { return; } m_StaticDataBySymbol.Add(srStaticData.StockSymbol, srStaticData); m_StaticDataArray.Add(srStaticData); }
public static SRDynamicData ScanSRDynamicData( StockFileInfo stockFileInfo, LHPScanInfo lhpScanInfo, SRStaticData srStaticData ) { SRDynamicData srDynamicData = new SRDynamicData(); return srDynamicData; }
public static void SaveSRStaticData( string strFile, SRStaticData srStaticData ) { }
private static void SetTrendRelativelyNumber( SRStaticData srStaticData ) { HashSet<int> hashSetSRStaticInfo = new HashSet<int>(); foreach ( var item in srStaticData.srTrendInfoArray ) hashSetSRStaticInfo.Add( item.SRStaticInfoA.LeftKLineNumber + item.SRStaticInfoA.RightLineNumber + item.SRStaticInfoB.LeftKLineNumber + item.SRStaticInfoB.RightLineNumber ); List<int> KLineNumber = new List<int>( 1024 ); while ( hashSetSRStaticInfo.Count > 0 ) { int iLow = int.MaxValue; foreach ( var item2 in hashSetSRStaticInfo ) { if ( item2 < iLow ) iLow = item2; } if ( iLow != int.MaxValue ) { KLineNumber.Add( iLow ); hashSetSRStaticInfo.Remove( iLow ); } } Dictionary<int, int> relativelyNumber = new Dictionary<int, int>(); Dictionary<int, float> relativelyNumber2 = new Dictionary<int, float>(); for ( int i = 0; i < KLineNumber.Count; i++ ) { relativelyNumber.Add( KLineNumber[i], ( i + 1 ) ); relativelyNumber2.Add( KLineNumber[i], MSFL.FormatPrice( (float)( i + 1 ) / (float)KLineNumber.Count ) ); } foreach ( var item3 in srStaticData.srTrendInfoArray ) { int outRelativelyNumber = 0; if ( relativelyNumber.TryGetValue( item3.SRStaticInfoA.LeftKLineNumber + item3.SRStaticInfoA.RightLineNumber + item3.SRStaticInfoB.LeftKLineNumber + item3.SRStaticInfoB.RightLineNumber, out outRelativelyNumber ) == true ) { float outRelativelyPercent = 0; if ( relativelyNumber2.TryGetValue( item3.SRStaticInfoA.LeftKLineNumber + item3.SRStaticInfoA.RightLineNumber + item3.SRStaticInfoB.LeftKLineNumber + item3.SRStaticInfoB.RightLineNumber, out outRelativelyPercent ) == true ) { item3.RelativelyNumber = outRelativelyNumber; item3.RelativelyPercent = outRelativelyPercent; } else throw new NotImplementedException(); } else throw new NotImplementedException(); } }
public static SRStaticData.SRStaticInfo[] GetSRStaticData( SRStaticData.SRStaticInfo[] srStaticInfoArray, DateTime dateTimeStart, DateTime dateTimeEnd ) { List<SRStaticData.SRStaticInfo> srStaticInfoList = new List<SRStaticData.SRStaticInfo>(); foreach ( var item in srStaticInfoArray ) { if ( item.StockData.StockDate < dateTimeStart && item.StockData.StockDate >= dateTimeEnd ) srStaticInfoList.Add( item ); } return srStaticInfoList.ToArray(); }
public static SRReport ScanSRStaticData( StockFileInfo stockFileInfo, LHPPrimaryScanInfo lhpScanInfo ) { MSFL.MSFLPriceRecord[] msflPriceRecordArray = new MSFL.MSFLPriceRecord[0]; if ( GlobalSetting.TryLoadMsflPriceInfo( stockFileInfo.StockName, stockFileInfo.StockSymbol, stockFileInfo.StockFilePath, out msflPriceRecordArray ) == false ) return null; if (msflPriceRecordArray.Length <= 0) return null; // 开始获取静态数据 SRStaticData srStaticData = new SRStaticData(); // 获取最新的股票数据 SRStaticData.StockData stockData = new SRStaticData.StockData(); stockData.StockDate = MSFL.FormatDate( msflPriceRecordArray[msflPriceRecordArray.Length - 1].lDate ); stockData.StockOpen = MSFL.FormatPrice( msflPriceRecordArray[msflPriceRecordArray.Length - 1].fOpen ); stockData.StockClose = MSFL.FormatPrice( msflPriceRecordArray[msflPriceRecordArray.Length - 1].fClose ); stockData.StockHigh = MSFL.FormatPrice( msflPriceRecordArray[msflPriceRecordArray.Length - 1].fHigh ); stockData.StockLow = MSFL.FormatPrice( msflPriceRecordArray[msflPriceRecordArray.Length - 1].fLow ); stockData.StockVolume = MSFL.FormatVolume( msflPriceRecordArray[msflPriceRecordArray.Length - 1].fVolume ); // 初始化静态数据 srStaticData.StockName = stockFileInfo.StockName; srStaticData.StockSymbol = stockFileInfo.StockSymbol; srStaticData.LastStock = stockData; //Debug.WriteLine( "*********************************************************************************" ); //Debug.WriteLine( "Stock Name = " + srStaticData.StockName ); //Debug.WriteLine( "Stock Symbol = " + srStaticData.StockSymbol ); //Debug.WriteLine( string.Empty ); //Debug.WriteLine( "---------------------------------------------------------------------------------"); //Debug.WriteLine( "LastStock = " ); //Debug.WriteLine( " Stock Date = " + srStaticData.LastStock.StockDate.ToShortDateString() ); //Debug.WriteLine( " Stock Open = " + srStaticData.LastStock.StockOpen.ToString() ); //Debug.WriteLine( " Stock Close = " + srStaticData.LastStock.StockClose.ToString() ); //Debug.WriteLine( " Stock High = " + srStaticData.LastStock.StockHigh.ToString() ); //Debug.WriteLine( " Stock Low = " + srStaticData.LastStock.StockLow.ToString() ); //Debug.WriteLine( " Stock Volume = " + srStaticData.LastStock.StockVolume.ToString() ); //Debug.WriteLine( "---------------------------------------------------------------------------------" ); //Debug.WriteLine( string.Empty ); int iScanSpace = lhpScanInfo.m_ScanBaseInfo.ScanSpace > 0 ? lhpScanInfo.m_ScanBaseInfo.ScanSpace : int.MaxValue; List<SRStaticData.SRStaticInfo> listStaticInfo = new List<SRStaticData.SRStaticInfo>(); for ( int iIndex = msflPriceRecordArray.Length - 2, iIndexQQQ = 0; iIndex >= 0 && iIndexQQQ < iScanSpace; iIndex--, iIndexQQQ++ ) { MSFL.MSFLPriceRecord msflPriceRecord = msflPriceRecordArray[iIndex]; DateTime stockDate = MSFL.FormatDate( msflPriceRecord.lDate ); float fHigh = MSFL.FormatPrice( msflPriceRecord.fHigh ); float fLow = MSFL.FormatPrice( msflPriceRecord.fLow ); float fOpen = MSFL.FormatPrice( msflPriceRecord.fOpen ); float fClose = MSFL.FormatPrice( msflPriceRecord.fClose ); float fVolume = MSFL.FormatPrice( msflPriceRecord.fVolume ); SRStaticData.SRStaticInfo staticInfo = new SRStaticData.SRStaticInfo(); if ( lhpScanInfo.m_ScanBaseInfo.AllowScanGapUp == true && lhpScanInfo.m_ScanBaseInfo.AllowGULK == true && GlobalSetting.IsGULK( iIndex, msflPriceRecordArray ) == true ) { float fHKLow = MSFL.FormatPrice( msflPriceRecordArray[iIndex + 1].fLow ); if ( ( ( fHKLow - fHigh ) / fHigh * 100 ) >= lhpScanInfo.m_ScanBaseInfo.GapUpPercentum ) { staticInfo.SRPointType |= SRStaticData.SRPointType.GULK; float fEntity = fOpen > fClose ? fOpen : fClose; staticInfo.GapPercentum = ( fLow - fHigh ) / fEntity; staticInfo.StockAverageHigh = MSFL.FormatPrice( fEntity + ( fHigh - fEntity ) / 2 ); int iLeftCount = 0; for ( int iIndexLeft = iIndex - 1; iIndexLeft >= 0; iIndexLeft-- ) { MSFL.MSFLPriceRecord msflPriceRecordLeft = msflPriceRecordArray[iIndexLeft]; float fLeftHigh = MSFL.FormatPrice( msflPriceRecordLeft.fHigh ); if ( fLeftHigh < fHigh ) iLeftCount++; else break; } int iRightCount = 0; for ( int iIndexRight = iIndex + 1; iIndexRight < msflPriceRecordArray.Length; iIndexRight++ ) { MSFL.MSFLPriceRecord msflPriceRecordRight = msflPriceRecordArray[iIndexRight]; float fRightHigh = MSFL.FormatPrice( msflPriceRecordRight.fHigh ); if ( fRightHigh < fHigh ) iRightCount++; else break; } staticInfo.LeftKLineNumber = iLeftCount; staticInfo.RightLineNumber = iRightCount; if ( fHigh > srStaticData.MaxDCHP ) srStaticData.MaxDCHP = fHigh; } } if ( lhpScanInfo.m_ScanBaseInfo.AllowScanGapUp == true && lhpScanInfo.m_ScanBaseInfo.AllowGUHK == true && GlobalSetting.IsGUHK( iIndex, msflPriceRecordArray ) == true ) { float fLKHigh = MSFL.FormatPrice( msflPriceRecordArray[iIndex - 1].fHigh ); if ( ( ( fLow - fLKHigh ) / fLKHigh * 100 ) >= lhpScanInfo.m_ScanBaseInfo.GapUpPercentum ) { staticInfo.SRPointType |= SRStaticData.SRPointType.GUHK; float fAverageGapVolume = 0; for ( int i2 = iIndex, k = 0; i2 >= 0 && k < 20; i2--, k++ ) { float gapVolume = MSFL.FormatVolume( msflPriceRecordArray[i2].fVolume ); fAverageGapVolume += gapVolume; } fAverageGapVolume = fAverageGapVolume / 20; staticInfo.GapVolumePercentum = MSFL.FormatVolume( ( ( fVolume - fAverageGapVolume ) / fAverageGapVolume ) * 100 ); float fLKOpen = MSFL.FormatPrice( msflPriceRecordArray[iIndex - 1].fOpen ); float fLKClose = MSFL.FormatPrice( msflPriceRecordArray[iIndex - 1].fClose ); float fLKEntity = fLKOpen > fLKClose ? fLKOpen : fLKClose; float fEntity = fOpen < fClose ? fOpen : fClose; staticInfo.GapPercentum = ( fLow - fLKHigh ) / fLKEntity; staticInfo.GapPriceSpace = MSFL.FormatPrice( ( ( fLow - fLKHigh ) / fLKHigh * 100 ) ); staticInfo.StockAverageLow = MSFL.FormatPrice( fLow + ( fEntity - fLow ) / 2 ); int iLeftCount = 0; for ( int iIndexLeft = iIndex - 1; iIndexLeft >= 0; iIndexLeft-- ) { MSFL.MSFLPriceRecord msflPriceRecordLeft = msflPriceRecordArray[iIndexLeft]; float fLeftLow = MSFL.FormatPrice( msflPriceRecordLeft.fLow ); if ( fLeftLow > fLow ) iLeftCount++; else break; } int iRightCount = 0; for ( int iIndexRight = iIndex + 1; iIndexRight < msflPriceRecordArray.Length; iIndexRight++ ) { MSFL.MSFLPriceRecord msflPriceRecordRight = msflPriceRecordArray[iIndexRight]; float fRightLow = MSFL.FormatPrice( msflPriceRecordRight.fLow ); if ( fRightLow > fLow ) iRightCount++; else break; } staticInfo.LeftKLineNumber = iLeftCount; staticInfo.RightLineNumber = iRightCount; if ( fLow < srStaticData.MinDCLP ) srStaticData.MinDCLP = fLow; } } if ( lhpScanInfo.m_ScanBaseInfo.AllowScanGapDown == true && lhpScanInfo.m_ScanBaseInfo.AllowGDLK == true && GlobalSetting.IsGDLK( iIndex, msflPriceRecordArray ) == true ) { float fHKLow = MSFL.FormatPrice( msflPriceRecordArray[iIndex - 1].fLow ); if ( ( ( fHKLow - fHigh ) / fHigh * 100 ) >= lhpScanInfo.m_ScanBaseInfo.GapDownPercentum ) { staticInfo.SRPointType |= SRStaticData.SRPointType.GDLK; float fAverageGapVolume = 0; for ( int i2 = iIndex, k = 0; i2 >= 0 && k < 20; i2--, k++ ) { float gapVolume = MSFL.FormatVolume( msflPriceRecordArray[i2].fVolume ); fAverageGapVolume += gapVolume; } fAverageGapVolume = fAverageGapVolume / 20; staticInfo.GapVolumePercentum = MSFL.FormatVolume( ( ( fVolume - fAverageGapVolume ) / fAverageGapVolume ) * 100 ); float fHKOpen = MSFL.FormatPrice( msflPriceRecordArray[iIndex - 1].fOpen ); float fHKClose = MSFL.FormatPrice( msflPriceRecordArray[iIndex - 1].fClose ); float fHKEntity = fHKOpen < fHKClose ? fHKOpen : fHKClose; float fEntity = fOpen > fClose ? fOpen : fClose; staticInfo.GapPercentum = ( fHKLow - fHigh ) / fHKEntity; staticInfo.GapPriceSpace = MSFL.FormatPrice( ( ( fHKLow - fHigh ) / fHigh * 100 ) ); staticInfo.StockAverageHigh = MSFL.FormatPrice( fEntity + ( fHigh - fEntity ) / 2 ); int iLeftCount = 0; for ( int iIndexLeft = iIndex - 1; iIndexLeft >= 0; iIndexLeft-- ) { MSFL.MSFLPriceRecord msflPriceRecordLeft = msflPriceRecordArray[iIndexLeft]; float fLeftHigh = MSFL.FormatPrice( msflPriceRecordLeft.fHigh ); if ( fLeftHigh < fHigh ) iLeftCount++; else break; } int iRightCount = 0; for ( int iIndexRight = iIndex + 1; iIndexRight < msflPriceRecordArray.Length; iIndexRight++ ) { MSFL.MSFLPriceRecord msflPriceRecordRight = msflPriceRecordArray[iIndexRight]; float fRightHigh = MSFL.FormatPrice( msflPriceRecordRight.fHigh ); if ( fRightHigh < fHigh ) iRightCount++; else break; } staticInfo.LeftKLineNumber = iLeftCount; staticInfo.RightLineNumber = iRightCount; if ( fHigh > srStaticData.MaxDCHP ) srStaticData.MaxDCHP = fHigh; } } if ( lhpScanInfo.m_ScanBaseInfo.AllowScanGapDown == true && lhpScanInfo.m_ScanBaseInfo.AllowGDHK == true && GlobalSetting.IsGDHK( iIndex, msflPriceRecordArray ) == true ) { float fLKHigh = MSFL.FormatPrice( msflPriceRecordArray[iIndex + 1].fHigh ); if ( ( ( fLow - fLKHigh ) / fLKHigh * 100 ) >= lhpScanInfo.m_ScanBaseInfo.GapDownPercentum ) { staticInfo.SRPointType |= SRStaticData.SRPointType.GDHK; float fEntity = fOpen < fClose ? fOpen : fClose; staticInfo.GapPercentum = ( fLow - fLKHigh ) / fEntity; staticInfo.StockAverageLow = MSFL.FormatPrice( fLow + ( fEntity - fLow ) / 2 ); int iLeftCount = 0; for ( int iIndexLeft = iIndex - 1; iIndexLeft >= 0; iIndexLeft-- ) { MSFL.MSFLPriceRecord msflPriceRecordLeft = msflPriceRecordArray[iIndexLeft]; float fLeftLow = MSFL.FormatPrice( msflPriceRecordLeft.fLow ); if ( fLeftLow > fLow ) iLeftCount++; else break; } int iRightCount = 0; for ( int iIndexRight = iIndex + 1; iIndexRight < msflPriceRecordArray.Length; iIndexRight++ ) { MSFL.MSFLPriceRecord msflPriceRecordRight = msflPriceRecordArray[iIndexRight]; float fRightLow = MSFL.FormatPrice( msflPriceRecordRight.fLow ); if ( fRightLow > fLow ) iRightCount++; else break; } staticInfo.LeftKLineNumber = iLeftCount; staticInfo.RightLineNumber = iRightCount; if ( fLow < srStaticData.MinDCLP ) srStaticData.MinDCLP = fLow; } } if ( lhpScanInfo.m_ScanBaseInfo.AllowScanDCLP == true && lhpScanInfo.m_ScanBaseInfo.AllowDCLP313 == true && GlobalSetting.IsDCLP_313( iIndex, msflPriceRecordArray ) == true ) { staticInfo.SRPointType = SRStaticData.SRPointType.DCLP; staticInfo.DCPointType = SRStaticData.DCPointType.DC_313; float fEntity = fOpen < fClose ? fOpen : fClose; staticInfo.StockAverageLow = MSFL.FormatPrice( fLow + ( fEntity - fLow ) / 2 ); int iLeftCount = 0; for ( int iIndexLeft = iIndex - 1; iIndexLeft >= 0; iIndexLeft-- ) { MSFL.MSFLPriceRecord msflPriceRecordLeft = msflPriceRecordArray[iIndexLeft]; float fLeftLow = MSFL.FormatPrice( msflPriceRecordLeft.fLow ); if ( fLeftLow > fLow ) iLeftCount++; else break; } int iRightCount = 0; for ( int iIndexRight = iIndex + 1; iIndexRight < msflPriceRecordArray.Length; iIndexRight++ ) { MSFL.MSFLPriceRecord msflPriceRecordRight = msflPriceRecordArray[iIndexRight]; float fRightLow = MSFL.FormatPrice( msflPriceRecordRight.fLow ); if ( fRightLow > fLow ) iRightCount++; else break; } staticInfo.LeftKLineNumber = iLeftCount; staticInfo.RightLineNumber = iRightCount; if ( fLow < srStaticData.MinDCLP ) srStaticData.MinDCLP = fLow; } else if ( lhpScanInfo.m_ScanBaseInfo.AllowScanDCLP == true && lhpScanInfo.m_ScanBaseInfo.AllowDCLP214 == true && GlobalSetting.IsDCLP_214( iIndex, msflPriceRecordArray ) == true ) { staticInfo.SRPointType |= SRStaticData.SRPointType.DCLP; staticInfo.DCPointType = SRStaticData.DCPointType.DC_214; float fEntity = fOpen < fClose ? fOpen : fClose; staticInfo.StockAverageLow = MSFL.FormatPrice( fLow + ( fEntity - fLow ) / 2 ); int iLeftCount = 0; for ( int iIndexLeft = iIndex - 1; iIndexLeft >= 0; iIndexLeft-- ) { MSFL.MSFLPriceRecord msflPriceRecordLeft = msflPriceRecordArray[iIndexLeft]; float fLeftLow = MSFL.FormatPrice( msflPriceRecordLeft.fLow ); if ( fLeftLow > fLow ) iLeftCount++; else break; } int iRightCount = 0; for ( int iIndexRight = iIndex + 1; iIndexRight < msflPriceRecordArray.Length; iIndexRight++ ) { MSFL.MSFLPriceRecord msflPriceRecordRight = msflPriceRecordArray[iIndexRight]; float fRightLow = MSFL.FormatPrice( msflPriceRecordRight.fLow ); if ( fRightLow > fLow ) iRightCount++; else break; } staticInfo.LeftKLineNumber = iLeftCount; staticInfo.RightLineNumber = iRightCount; if ( fLow < srStaticData.MinDCLP ) srStaticData.MinDCLP = fLow; } else if ( lhpScanInfo.m_ScanBaseInfo.AllowScanDCLP == true && lhpScanInfo.m_ScanBaseInfo.AllowDCLP115 == true && GlobalSetting.IsDCLP_115( iIndex, msflPriceRecordArray ) == true ) { staticInfo.SRPointType |= SRStaticData.SRPointType.DCLP; staticInfo.DCPointType = SRStaticData.DCPointType.DC_115; float fEntity = fOpen < fClose ? fOpen : fClose; staticInfo.StockAverageLow = MSFL.FormatPrice( fLow + ( fEntity - fLow ) / 2 ); int iLeftCount = 0; for ( int iIndexLeft = iIndex - 1; iIndexLeft >= 0; iIndexLeft-- ) { MSFL.MSFLPriceRecord msflPriceRecordLeft = msflPriceRecordArray[iIndexLeft]; float fLeftLow = MSFL.FormatPrice( msflPriceRecordLeft.fLow ); if ( fLeftLow > fLow ) iLeftCount++; else break; } int iRightCount = 0; for ( int iIndexRight = iIndex + 1; iIndexRight < msflPriceRecordArray.Length; iIndexRight++ ) { MSFL.MSFLPriceRecord msflPriceRecordRight = msflPriceRecordArray[iIndexRight]; float fRightLow = MSFL.FormatPrice( msflPriceRecordRight.fLow ); if ( fRightLow > fLow ) iRightCount++; else break; } staticInfo.LeftKLineNumber = iLeftCount; staticInfo.RightLineNumber = iRightCount; if ( fLow < srStaticData.MinDCLP ) srStaticData.MinDCLP = fLow; } else if ( lhpScanInfo.m_ScanBaseInfo.AllowScanDCLP == true && lhpScanInfo.m_ScanBaseInfo.AllowDCLP412 == true && GlobalSetting.IsDCLP_412( iIndex, msflPriceRecordArray ) == true ) { staticInfo.SRPointType |= SRStaticData.SRPointType.DCLP; staticInfo.DCPointType = SRStaticData.DCPointType.DC_412; float fEntity = fOpen < fClose ? fOpen : fClose; staticInfo.StockAverageLow = MSFL.FormatPrice( fLow + ( fEntity - fLow ) / 2 ); int iLeftCount = 0; for ( int iIndexLeft = iIndex - 1; iIndexLeft >= 0; iIndexLeft-- ) { MSFL.MSFLPriceRecord msflPriceRecordLeft = msflPriceRecordArray[iIndexLeft]; float fLeftLow = MSFL.FormatPrice( msflPriceRecordLeft.fLow ); if ( fLeftLow > fLow ) iLeftCount++; else break; } int iRightCount = 0; for ( int iIndexRight = iIndex + 1; iIndexRight < msflPriceRecordArray.Length; iIndexRight++ ) { MSFL.MSFLPriceRecord msflPriceRecordRight = msflPriceRecordArray[iIndexRight]; float fRightLow = MSFL.FormatPrice( msflPriceRecordRight.fLow ); if ( fRightLow > fLow ) iRightCount++; else break; } staticInfo.LeftKLineNumber = iLeftCount; staticInfo.RightLineNumber = iRightCount; if ( fLow < srStaticData.MinDCLP ) srStaticData.MinDCLP = fLow; } else if ( lhpScanInfo.m_ScanBaseInfo.AllowScanDCLP == true && lhpScanInfo.m_ScanBaseInfo.AllowDCLP511 == true && GlobalSetting.IsDCLP_511( iIndex, msflPriceRecordArray ) == true ) { staticInfo.SRPointType |= SRStaticData.SRPointType.DCLP; staticInfo.DCPointType = SRStaticData.DCPointType.DC_511; float fEntity = fOpen < fClose ? fOpen : fClose; staticInfo.StockAverageLow = MSFL.FormatPrice( fLow + ( fEntity - fLow ) / 2 ); int iLeftCount = 0; for ( int iIndexLeft = iIndex - 1; iIndexLeft >= 0; iIndexLeft-- ) { MSFL.MSFLPriceRecord msflPriceRecordLeft = msflPriceRecordArray[iIndexLeft]; float fLeftLow = MSFL.FormatPrice( msflPriceRecordLeft.fLow ); if ( fLeftLow > fLow ) iLeftCount++; else break; } int iRightCount = 0; for ( int iIndexRight = iIndex + 1; iIndexRight < msflPriceRecordArray.Length; iIndexRight++ ) { MSFL.MSFLPriceRecord msflPriceRecordRight = msflPriceRecordArray[iIndexRight]; float fRightLow = MSFL.FormatPrice( msflPriceRecordRight.fLow ); if ( fRightLow > fLow ) iRightCount++; else break; } staticInfo.LeftKLineNumber = iLeftCount; staticInfo.RightLineNumber = iRightCount; if ( fLow < srStaticData.MinDCLP ) srStaticData.MinDCLP = fLow; } if ( lhpScanInfo.m_ScanBaseInfo.AllowScanDCHP == true && lhpScanInfo.m_ScanBaseInfo.AllowDCHP313 == true && GlobalSetting.IsDCHP_313( iIndex, msflPriceRecordArray ) == true ) { staticInfo.SRPointType |= SRStaticData.SRPointType.DCHP; staticInfo.DCPointType = SRStaticData.DCPointType.DC_313; float fEntity = fOpen > fClose ? fOpen : fClose; staticInfo.StockAverageHigh = MSFL.FormatPrice( fEntity + ( fHigh - fEntity ) / 2 ); int iLeftCount = 0; for ( int iIndexLeft = iIndex - 1; iIndexLeft >= 0; iIndexLeft-- ) { MSFL.MSFLPriceRecord msflPriceRecordLeft = msflPriceRecordArray[iIndexLeft]; float fLeftHigh = MSFL.FormatPrice( msflPriceRecordLeft.fHigh ); if ( fLeftHigh < fHigh ) iLeftCount++; else break; } int iRightCount = 0; for ( int iIndexRight = iIndex + 1; iIndexRight < msflPriceRecordArray.Length; iIndexRight++ ) { MSFL.MSFLPriceRecord msflPriceRecordRight = msflPriceRecordArray[iIndexRight]; float fRightHigh = MSFL.FormatPrice( msflPriceRecordRight.fHigh ); if ( fRightHigh < fHigh ) iRightCount++; else break; } staticInfo.LeftKLineNumber = iLeftCount; staticInfo.RightLineNumber = iRightCount; if ( fHigh > srStaticData.MaxDCHP ) srStaticData.MaxDCHP = fHigh; } else if ( lhpScanInfo.m_ScanBaseInfo.AllowScanDCHP == true && lhpScanInfo.m_ScanBaseInfo.AllowDCHP214 == true && GlobalSetting.IsDCHP_214( iIndex, msflPriceRecordArray ) == true ) { staticInfo.SRPointType |= SRStaticData.SRPointType.DCHP; staticInfo.DCPointType = SRStaticData.DCPointType.DC_214; float fEntity = fOpen > fClose ? fOpen : fClose; staticInfo.StockAverageHigh = MSFL.FormatPrice( fEntity + ( fHigh - fEntity ) / 2 ); int iLeftCount = 0; for ( int iIndexLeft = iIndex - 1; iIndexLeft >= 0; iIndexLeft-- ) { MSFL.MSFLPriceRecord msflPriceRecordLeft = msflPriceRecordArray[iIndexLeft]; float fLeftHigh = MSFL.FormatPrice( msflPriceRecordLeft.fHigh ); if ( fLeftHigh < fHigh ) iLeftCount++; else break; } int iRightCount = 0; for ( int iIndexRight = iIndex + 1; iIndexRight < msflPriceRecordArray.Length; iIndexRight++ ) { MSFL.MSFLPriceRecord msflPriceRecordRight = msflPriceRecordArray[iIndexRight]; float fRightHigh = MSFL.FormatPrice( msflPriceRecordRight.fHigh ); if ( fRightHigh < fHigh ) iRightCount++; else break; } staticInfo.LeftKLineNumber = iLeftCount; staticInfo.RightLineNumber = iRightCount; if ( fHigh > srStaticData.MaxDCHP ) srStaticData.MaxDCHP = fHigh; } else if ( lhpScanInfo.m_ScanBaseInfo.AllowScanDCHP == true && lhpScanInfo.m_ScanBaseInfo.AllowDCHP115 == true && GlobalSetting.IsDCHP_115( iIndex, msflPriceRecordArray ) == true ) { staticInfo.SRPointType |= SRStaticData.SRPointType.DCHP; staticInfo.DCPointType = SRStaticData.DCPointType.DC_115; float fEntity = fOpen > fClose ? fOpen : fClose; staticInfo.StockAverageHigh = MSFL.FormatPrice( fEntity + ( fHigh - fEntity ) / 2 ); int iLeftCount = 0; for ( int iIndexLeft = iIndex - 1; iIndexLeft >= 0; iIndexLeft-- ) { MSFL.MSFLPriceRecord msflPriceRecordLeft = msflPriceRecordArray[iIndexLeft]; float fLeftHigh = MSFL.FormatPrice( msflPriceRecordLeft.fHigh ); if ( fLeftHigh < fHigh ) iLeftCount++; else break; } int iRightCount = 0; for ( int iIndexRight = iIndex + 1; iIndexRight < msflPriceRecordArray.Length; iIndexRight++ ) { MSFL.MSFLPriceRecord msflPriceRecordRight = msflPriceRecordArray[iIndexRight]; float fRightHigh = MSFL.FormatPrice( msflPriceRecordRight.fHigh ); if ( fRightHigh < fHigh ) iRightCount++; else break; } staticInfo.LeftKLineNumber = iLeftCount; staticInfo.RightLineNumber = iRightCount; if ( fHigh > srStaticData.MaxDCHP ) srStaticData.MaxDCHP = fHigh; } else if ( lhpScanInfo.m_ScanBaseInfo.AllowScanDCHP == true && lhpScanInfo.m_ScanBaseInfo.AllowDCHP412 == true && GlobalSetting.IsDCHP_412( iIndex, msflPriceRecordArray ) == true ) { staticInfo.SRPointType |= SRStaticData.SRPointType.DCHP; staticInfo.DCPointType = SRStaticData.DCPointType.DC_412; float fEntity = fOpen > fClose ? fOpen : fClose; staticInfo.StockAverageHigh = MSFL.FormatPrice( fEntity + ( fHigh - fEntity ) / 2 ); int iLeftCount = 0; for ( int iIndexLeft = iIndex - 1; iIndexLeft >= 0; iIndexLeft-- ) { MSFL.MSFLPriceRecord msflPriceRecordLeft = msflPriceRecordArray[iIndexLeft]; float fLeftHigh = MSFL.FormatPrice( msflPriceRecordLeft.fHigh ); if ( fLeftHigh < fHigh ) iLeftCount++; else break; } int iRightCount = 0; for ( int iIndexRight = iIndex + 1; iIndexRight < msflPriceRecordArray.Length; iIndexRight++ ) { MSFL.MSFLPriceRecord msflPriceRecordRight = msflPriceRecordArray[iIndexRight]; float fRightHigh = MSFL.FormatPrice( msflPriceRecordRight.fHigh ); if ( fRightHigh < fHigh ) iRightCount++; else break; } staticInfo.LeftKLineNumber = iLeftCount; staticInfo.RightLineNumber = iRightCount; if ( fHigh > srStaticData.MaxDCHP ) srStaticData.MaxDCHP = fHigh; } else if ( lhpScanInfo.m_ScanBaseInfo.AllowScanDCHP == true && lhpScanInfo.m_ScanBaseInfo.AllowDCHP511 == true && GlobalSetting.IsDCHP_511( iIndex, msflPriceRecordArray ) == true ) { staticInfo.SRPointType |= SRStaticData.SRPointType.DCHP; staticInfo.DCPointType = SRStaticData.DCPointType.DC_511; float fEntity = fOpen > fClose ? fOpen : fClose; staticInfo.StockAverageHigh = MSFL.FormatPrice( fEntity + ( fHigh - fEntity ) / 2 ); int iLeftCount = 0; for ( int iIndexLeft = iIndex - 1; iIndexLeft >= 0; iIndexLeft-- ) { MSFL.MSFLPriceRecord msflPriceRecordLeft = msflPriceRecordArray[iIndexLeft]; float fLeftHigh = MSFL.FormatPrice( msflPriceRecordLeft.fHigh ); if ( fLeftHigh < fHigh ) iLeftCount++; else break; } int iRightCount = 0; for ( int iIndexRight = iIndex + 1; iIndexRight < msflPriceRecordArray.Length; iIndexRight++ ) { MSFL.MSFLPriceRecord msflPriceRecordRight = msflPriceRecordArray[iIndexRight]; float fRightHigh = MSFL.FormatPrice( msflPriceRecordRight.fHigh ); if ( fRightHigh < fHigh ) iRightCount++; else break; } staticInfo.LeftKLineNumber = iLeftCount; staticInfo.RightLineNumber = iRightCount; if ( fHigh > srStaticData.MaxDCHP ) srStaticData.MaxDCHP = fHigh; } if ( staticInfo.SRPointType == SRStaticData.SRPointType.None ) continue; SRStaticData.StockData stockDataX = new SRStaticData.StockData(); stockDataX.StockDate = MSFL.FormatDate( msflPriceRecord.lDate ); stockDataX.StockOpen = MSFL.FormatPrice( msflPriceRecord.fOpen ); stockDataX.StockHigh = MSFL.FormatPrice( msflPriceRecord.fHigh ); stockDataX.StockLow = MSFL.FormatPrice( msflPriceRecord.fLow ); stockDataX.StockClose = MSFL.FormatPrice( msflPriceRecord.fClose ); stockDataX.StockVolume = MSFL.FormatVolume( msflPriceRecord.fVolume ); staticInfo.StockData = stockDataX; listStaticInfo.Add( staticInfo ); } srStaticData.srStaticInfoArray = listStaticInfo.ToArray(); List<SRStaticData.SRTrendInfo> listTrendInfo = new List<SRStaticData.SRTrendInfo>(); for ( int iIndex = 0; iIndex < ( srStaticData.srStaticInfoArray.Length - 1 ); iIndex++ ) { SRStaticData.SRStaticInfo srStaticInfoA = srStaticData.srStaticInfoArray[iIndex]; for ( int iIndex2 = iIndex + 1; iIndex2 < srStaticData.srStaticInfoArray.Length; iIndex2++ ) { SRStaticData.SRStaticInfo srStaticInfoB = srStaticData.srStaticInfoArray[iIndex2]; if ( srStaticInfoA.StockData.StockDate <= srStaticInfoB.StockData.StockDate ) continue; if ( ( (srStaticInfoA.SRPointType & SRStaticData.SRPointType.DCHP) == SRStaticData.SRPointType.DCHP || ( srStaticInfoA.SRPointType & SRStaticData.SRPointType.GULK ) == SRStaticData.SRPointType.GULK || ( srStaticInfoA.SRPointType & SRStaticData.SRPointType.GDLK ) == SRStaticData.SRPointType.GDLK ) && ( ( srStaticInfoB.SRPointType & SRStaticData.SRPointType.DCHP ) == SRStaticData.SRPointType.DCHP || ( srStaticInfoB.SRPointType & SRStaticData.SRPointType.GULK ) == SRStaticData.SRPointType.GULK || ( srStaticInfoB.SRPointType & SRStaticData.SRPointType.GDLK ) == SRStaticData.SRPointType.GDLK ) ) { if ( srStaticInfoA.StockData.StockHigh < srStaticInfoB.StockData.StockHigh ) { SRStaticData.SRTrendInfo srTrendInfo = new SRStaticData.SRTrendInfo(); srTrendInfo.SRStaticInfoA = srStaticInfoA; srTrendInfo.SRStaticInfoB = srStaticInfoB; srTrendInfo.TrendInfo = SRStaticData.TrendType.Down; srTrendInfo.GUID = Guid.NewGuid().ToString(); // listTrendInfo.Add( srTrendInfo ); } } else if ( ( ( srStaticInfoA.SRPointType & SRStaticData.SRPointType.DCLP ) == SRStaticData.SRPointType.DCLP || ( srStaticInfoA.SRPointType & SRStaticData.SRPointType.GUHK ) == SRStaticData.SRPointType.GUHK || ( srStaticInfoA.SRPointType & SRStaticData.SRPointType.GDHK ) == SRStaticData.SRPointType.GDHK ) && ( ( srStaticInfoB.SRPointType & SRStaticData.SRPointType.DCLP ) == SRStaticData.SRPointType.DCLP || ( srStaticInfoB.SRPointType & SRStaticData.SRPointType.GUHK ) == SRStaticData.SRPointType.GUHK || ( srStaticInfoB.SRPointType & SRStaticData.SRPointType.GDHK ) == SRStaticData.SRPointType.GDHK ) ) { if ( srStaticInfoA.StockData.StockLow > srStaticInfoB.StockData.StockLow ) { SRStaticData.SRTrendInfo srTrendInfo = new SRStaticData.SRTrendInfo(); srTrendInfo.SRStaticInfoA = srStaticInfoA; srTrendInfo.SRStaticInfoB = srStaticInfoB; srTrendInfo.TrendInfo = SRStaticData.TrendType.Up; srTrendInfo.GUID = Guid.NewGuid().ToString(); // listTrendInfo.Add( srTrendInfo ); } } else break; } } srStaticData.srTrendInfoArray = listTrendInfo.ToArray(); SetStaticRelativelyNumber( srStaticData ); SetTrendRelativelyNumber( srStaticData ); // 开始计算动态值 SRDynamicData srDynamicData = new SRDynamicData(); // 初始化动态值 srDynamicData.StockName = stockFileInfo.StockName; srDynamicData.StockSymbol = stockFileInfo.StockSymbol; for ( int i = ( msflPriceRecordArray.Length - 1 ); i >= 0; i-- ) { MSFL.MSFLPriceRecord msflPriceRecord = msflPriceRecordArray[i]; DateTime stockDate = MSFL.FormatDate( msflPriceRecord.lDate ); if ( lhpScanInfo.m_ScanNormalInfo.ScanDate >= stockDate ) { SRDynamicData.StockData stockDataCurrent = new SRDynamicData.StockData(); stockDataCurrent.StockDate = stockDate; stockDataCurrent.StockOpen = MSFL.FormatPrice( msflPriceRecord.fOpen ); stockDataCurrent.StockHigh = MSFL.FormatPrice( msflPriceRecord.fHigh ); stockDataCurrent.StockLow = MSFL.FormatPrice( msflPriceRecord.fLow ); stockDataCurrent.StockClose = MSFL.FormatPrice( msflPriceRecord.fClose ); stockDataCurrent.StockVolume = MSFL.FormatVolume( msflPriceRecord.fVolume ); // 初始化动态值当前的股票 srDynamicData.CurrentStock = stockDataCurrent; srDynamicData.StockCPF = MSFL.FormatPrice( stockDataCurrent.StockHigh - stockDataCurrent.StockLow ); srDynamicData.StockCRPF = MSFL.FormatPrice( srDynamicData.StockCPF / stockDataCurrent.StockClose ); if ( i > 1 ) { float fPerClose = MSFL.FormatPrice( msflPriceRecordArray[i - 1].fClose ); if ( fPerClose < stockDataCurrent.StockClose ) { srDynamicData.PriceFloat = MSFL.FormatPrice( ( stockDataCurrent.StockClose - fPerClose ) / stockDataCurrent.StockClose ); } else if ( fPerClose > stockDataCurrent.StockClose ) { srDynamicData.PriceFloat = MSFL.FormatPrice( -( ( fPerClose - stockDataCurrent.StockClose ) / stockDataCurrent.StockClose ) ); } else srDynamicData.PriceFloat = 0F; } float fAverageAPF = 0; float fAverageARPF = 0; for ( int i2 = i, k = 0; i2 >= 0 && k < 20; i2--, k++ ) { float fHigh = MSFL.FormatPrice( msflPriceRecordArray[i2].fHigh ); float fLow = MSFL.FormatPrice( msflPriceRecordArray[i2].fLow ); float fClose = MSFL.FormatPrice( msflPriceRecordArray[i2].fClose ); fAverageAPF += ( fHigh + fLow ); fAverageARPF += fAverageAPF / fClose; } srDynamicData.StockAPF = MSFL.FormatPrice( fAverageAPF / 20 ); srDynamicData.StockARPF = MSFL.FormatPrice( fAverageARPF / 20 ); List<SRDynamicData.TrendData> listTrendData = new List<SRDynamicData.TrendData>(); for ( int iIndex = 0; iIndex < ( srStaticData.srTrendInfoArray.Length - 1 ); iIndex++ ) { SRStaticData.SRTrendInfo srSRTrendInfo = srStaticData.srTrendInfoArray[iIndex]; SRDynamicData.TrendData trendData = new SRDynamicData.TrendData(); trendData.GUID = srSRTrendInfo.GUID; trendData.SRTrendInfo = srSRTrendInfo; trendData.CSR = 0; if ( srSRTrendInfo.SRStaticInfoA.StockData.StockDate >= stockDataCurrent.StockDate || srSRTrendInfo.SRStaticInfoB.StockData.StockDate >= stockDataCurrent.StockDate ) break; int iNumMin = 0; int iNumMax = 0; int iNum = 1; for ( int i6 = i; i6 >= 0; i6-- ) { MSFL.MSFLPriceRecord msflPriceRecordX = msflPriceRecordArray[i6]; DateTime stockDateX = MSFL.FormatDate( msflPriceRecordX.lDate ); if ( stockDateX == srSRTrendInfo.SRStaticInfoA.StockData.StockDate ) iNumMin = iNum; if ( stockDateX == srSRTrendInfo.SRStaticInfoB.StockData.StockDate ) iNumMax = iNum; iNum++; } if (srSRTrendInfo.TrendInfo == SRStaticData.TrendType.Down ) { float G = ( srSRTrendInfo.SRStaticInfoA.StockData.StockHigh - srSRTrendInfo.SRStaticInfoB.StockData.StockHigh ) / ( iNumMax - iNumMin ); float DTLP = srSRTrendInfo.SRStaticInfoA.StockData.StockHigh - G * ( iNumMax - 1 ); trendData.CSR = MSFL.FormatPrice( DTLP ); } else if (srSRTrendInfo.TrendInfo == SRStaticData.TrendType.Up) { float G = ( srSRTrendInfo.SRStaticInfoA.StockData.StockLow - srSRTrendInfo.SRStaticInfoB.StockData.StockLow ) / ( iNumMax - iNumMin ); float DTLP = srSRTrendInfo.SRStaticInfoA.StockData.StockLow - G * ( iNumMax - 1 ); trendData.CSR = MSFL.FormatPrice( DTLP ); } else break; listTrendData.Add( trendData ); } srDynamicData.srTrendDataArray = listTrendData.ToArray(); break; } } float fSRCK_R = float.MaxValue; float fSRCK_S = float.MinValue; for ( int iA = 0; iA < srStaticData.srStaticInfoArray.Length; iA++ ) { SRStaticData.SRStaticInfo SRStaticInfo = srStaticData.srStaticInfoArray[iA]; if ( ( SRStaticInfo.SRPointType & SRStaticData.SRPointType.DCHP ) == SRStaticData.SRPointType.DCHP ) { if ( SRStaticInfo.StockAverageHigh > srDynamicData.CurrentStock.StockClose ) { if ( SRStaticInfo.StockAverageHigh < fSRCK_R ) fSRCK_R = SRStaticInfo.StockAverageHigh; } else if ( SRStaticInfo.StockAverageHigh < srDynamicData.CurrentStock.StockClose ) { if ( SRStaticInfo.StockAverageHigh > fSRCK_S ) fSRCK_S = SRStaticInfo.StockAverageHigh; } } if ( ( SRStaticInfo.SRPointType & SRStaticData.SRPointType.DCLP ) == SRStaticData.SRPointType.DCLP ) { if ( SRStaticInfo.StockAverageLow > srDynamicData.CurrentStock.StockClose ) { if ( SRStaticInfo.StockAverageLow < fSRCK_R ) fSRCK_R = SRStaticInfo.StockAverageLow; } else if ( SRStaticInfo.StockAverageLow < srDynamicData.CurrentStock.StockClose ) { if ( SRStaticInfo.StockAverageLow > fSRCK_S ) fSRCK_S = SRStaticInfo.StockAverageLow; } } if ( ( SRStaticInfo.SRPointType & SRStaticData.SRPointType.GDHK ) == SRStaticData.SRPointType.GDHK ) { if ( SRStaticInfo.StockAverageLow > srDynamicData.CurrentStock.StockClose ) { if ( SRStaticInfo.StockAverageLow < fSRCK_R ) fSRCK_R = SRStaticInfo.StockAverageLow; } else if ( SRStaticInfo.StockAverageLow < srDynamicData.CurrentStock.StockClose ) { if ( SRStaticInfo.StockAverageLow > fSRCK_S ) fSRCK_S = SRStaticInfo.StockAverageLow; } } if ( ( SRStaticInfo.SRPointType & SRStaticData.SRPointType.GDLK ) == SRStaticData.SRPointType.GDLK ) { if ( SRStaticInfo.StockAverageHigh > srDynamicData.CurrentStock.StockClose ) { if ( SRStaticInfo.StockAverageHigh < fSRCK_R ) fSRCK_R = SRStaticInfo.StockAverageHigh; } else if ( SRStaticInfo.StockAverageHigh < srDynamicData.CurrentStock.StockClose ) { if ( SRStaticInfo.StockAverageHigh > fSRCK_S ) fSRCK_S = SRStaticInfo.StockAverageHigh; } } if ( ( SRStaticInfo.SRPointType & SRStaticData.SRPointType.GUHK ) == SRStaticData.SRPointType.GUHK ) { if ( SRStaticInfo.StockAverageLow > srDynamicData.CurrentStock.StockClose ) { if ( SRStaticInfo.StockAverageLow < fSRCK_R ) fSRCK_R = SRStaticInfo.StockAverageLow; } else if ( SRStaticInfo.StockAverageLow < srDynamicData.CurrentStock.StockClose ) { if ( SRStaticInfo.StockAverageLow > fSRCK_S ) fSRCK_S = SRStaticInfo.StockAverageLow; } } if ( ( SRStaticInfo.SRPointType & SRStaticData.SRPointType.GULK ) == SRStaticData.SRPointType.GULK ) { if ( SRStaticInfo.StockAverageHigh > srDynamicData.CurrentStock.StockClose ) { if ( SRStaticInfo.StockAverageHigh < fSRCK_R ) fSRCK_R = SRStaticInfo.StockAverageHigh; } else if ( SRStaticInfo.StockAverageHigh < srDynamicData.CurrentStock.StockClose ) { if ( SRStaticInfo.StockAverageHigh > fSRCK_S ) fSRCK_S = SRStaticInfo.StockAverageHigh; } } } if ( fSRCK_R != float.MaxValue ) { MessageBox.Show( fSRCK_R.ToString() ); srDynamicData.StaticSRCK_R = MSFL.FormatPrice( ( ( fSRCK_R - srDynamicData.CurrentStock.StockClose ) / srDynamicData.CurrentStock.StockClose ) * 100 ); srDynamicData.StaticSRCK_RV = MSFL.FormatPrice( fSRCK_R ); } if ( fSRCK_S != float.MinValue ) { srDynamicData.StaticSRCK_S = MSFL.FormatPrice( ( ( srDynamicData.CurrentStock.StockClose - fSRCK_S ) / srDynamicData.CurrentStock.StockClose ) * 100 ); srDynamicData.StaticSRCK_SV = MSFL.FormatPrice( fSRCK_S ); } fSRCK_R = float.MaxValue; fSRCK_S = float.MinValue; for ( int i2 = 0; i2 < srDynamicData.srTrendDataArray.Length; i2++ ) { SRDynamicData.TrendData trendData = srDynamicData.srTrendDataArray[i2]; if ( trendData.CSR > srDynamicData.CurrentStock.StockClose ) { if ( trendData.CSR < fSRCK_R ) fSRCK_R = trendData.CSR; } else if ( trendData.CSR < srDynamicData.CurrentStock.StockClose ) { if ( trendData.CSR > fSRCK_S ) fSRCK_S = trendData.CSR; } } if ( fSRCK_R != float.MaxValue ) { srDynamicData.DynamicSRCK_R = MSFL.FormatPrice( ( ( fSRCK_R - srDynamicData.CurrentStock.StockClose ) / srDynamicData.CurrentStock.StockClose ) * 100 ); srDynamicData.DynamicSRCK_RV = MSFL.FormatPrice( fSRCK_R ); } if ( fSRCK_S != float.MinValue ) { srDynamicData.DynamicSRCK_S = MSFL.FormatPrice( ( ( srDynamicData.CurrentStock.StockClose - fSRCK_S ) / srDynamicData.CurrentStock.StockClose ) * 100 ); srDynamicData.DynamicSRCK_SV = MSFL.FormatPrice( fSRCK_S ); } SRReport srReport = new SRReport(); srReport.SRStaticData = srStaticData; srReport.SRDynamicData = srDynamicData; return srReport; }
private void Insert( SRStaticData.SRStaticInfo srStaticInfo, string strText, int iIndex, SRStaticData.SRPointType srPointType, string strGPS, string strVG ) { ListViewItemInfo listViewItemInfo = new ListViewItemInfo(); ListViewItem listViewItem = new ListViewItem( iIndex.ToString() ); listViewItemInfo.Column = iIndex; ListViewItem.ListViewSubItem subListViewItem1 = new ListViewItem.ListViewSubItem(); switch ( srPointType ) { case SRStaticData.SRPointType.DCHP: subListViewItem1.Text = srStaticInfo.StockAverageHigh.ToString(); listViewItemInfo.Column1 = srStaticInfo.StockAverageHigh; break; case SRStaticData.SRPointType.DCLP: subListViewItem1.Text = srStaticInfo.StockAverageLow.ToString(); listViewItemInfo.Column1 = srStaticInfo.StockAverageLow; break; case SRStaticData.SRPointType.GULK: subListViewItem1.Text = srStaticInfo.StockAverageHigh.ToString(); listViewItemInfo.Column1 = srStaticInfo.StockAverageHigh; break; case SRStaticData.SRPointType.GUHK: subListViewItem1.Text = srStaticInfo.StockAverageLow.ToString(); listViewItemInfo.Column1 = srStaticInfo.StockAverageLow; break; case SRStaticData.SRPointType.GDLK: subListViewItem1.Text = srStaticInfo.StockAverageHigh.ToString(); listViewItemInfo.Column1 = srStaticInfo.StockAverageHigh; break; case SRStaticData.SRPointType.GDHK: subListViewItem1.Text = srStaticInfo.StockAverageLow.ToString(); listViewItemInfo.Column1 = srStaticInfo.StockAverageLow; break; default: subListViewItem1.Text = string.Empty; listViewItemInfo.Column1 = 0F; break; } float fEntity = 0; ListViewItem.ListViewSubItem subListViewItem2 = new ListViewItem.ListViewSubItem(); subListViewItem2.ForeColor = Color.Green; switch ( srPointType ) { case SRStaticData.SRPointType.DCHP: subListViewItem2.Text = srStaticInfo.StockData.StockHigh.ToString(); listViewItemInfo.Column2 = srStaticInfo.StockData.StockHigh; break; case SRStaticData.SRPointType.DCLP: fEntity = srStaticInfo.StockData.StockOpen > srStaticInfo.StockData.StockClose ? srStaticInfo.StockData.StockClose : srStaticInfo.StockData.StockOpen; subListViewItem2.Text = fEntity.ToString(); listViewItemInfo.Column2 = fEntity; break; case SRStaticData.SRPointType.GULK: subListViewItem2.Text = srStaticInfo.StockData.StockHigh.ToString(); listViewItemInfo.Column2 = srStaticInfo.StockData.StockHigh; break; case SRStaticData.SRPointType.GUHK: fEntity = srStaticInfo.StockData.StockOpen > srStaticInfo.StockData.StockClose ? srStaticInfo.StockData.StockClose : srStaticInfo.StockData.StockOpen; subListViewItem2.Text = fEntity.ToString(); listViewItemInfo.Column2 = fEntity; break; case SRStaticData.SRPointType.GDLK: subListViewItem2.Text = srStaticInfo.StockData.StockHigh.ToString(); listViewItemInfo.Column2 = srStaticInfo.StockData.StockHigh; break; case SRStaticData.SRPointType.GDHK: fEntity = srStaticInfo.StockData.StockOpen > srStaticInfo.StockData.StockClose ? srStaticInfo.StockData.StockClose : srStaticInfo.StockData.StockOpen; subListViewItem2.Text = fEntity.ToString(); listViewItemInfo.Column2 = fEntity; break; default: subListViewItem2.Text = string.Empty; break; } ListViewItem.ListViewSubItem subListViewItem3 = new ListViewItem.ListViewSubItem(); subListViewItem3.ForeColor = Color.Red; switch ( srPointType ) { case SRStaticData.SRPointType.DCHP: fEntity = srStaticInfo.StockData.StockOpen > srStaticInfo.StockData.StockClose ? srStaticInfo.StockData.StockOpen : srStaticInfo.StockData.StockClose; subListViewItem3.Text = fEntity.ToString(); listViewItemInfo.Column3 = fEntity; break; case SRStaticData.SRPointType.DCLP: subListViewItem3.Text = srStaticInfo.StockData.StockLow.ToString(); listViewItemInfo.Column3 = srStaticInfo.StockData.StockLow; break; case SRStaticData.SRPointType.GULK: fEntity = srStaticInfo.StockData.StockOpen > srStaticInfo.StockData.StockClose ? srStaticInfo.StockData.StockOpen : srStaticInfo.StockData.StockClose; subListViewItem3.Text = fEntity.ToString(); listViewItemInfo.Column3 = fEntity; break; case SRStaticData.SRPointType.GUHK: subListViewItem3.Text = srStaticInfo.StockData.StockLow.ToString(); listViewItemInfo.Column3 = srStaticInfo.StockData.StockLow; break; case SRStaticData.SRPointType.GDLK: fEntity = srStaticInfo.StockData.StockOpen > srStaticInfo.StockData.StockClose ? srStaticInfo.StockData.StockOpen : srStaticInfo.StockData.StockClose; subListViewItem3.Text = fEntity.ToString(); listViewItemInfo.Column3 = fEntity; break; case SRStaticData.SRPointType.GDHK: subListViewItem3.Text = srStaticInfo.StockData.StockLow.ToString(); listViewItemInfo.Column3 = srStaticInfo.StockData.StockLow; break; default: subListViewItem3.Text = string.Empty; break; } ListViewItem.ListViewSubItem subListViewItem4 = new ListViewItem.ListViewSubItem(); subListViewItem4.Text = srStaticInfo.StockData.StockDate.ToShortDateString(); listViewItemInfo.Column4 = srStaticInfo.StockData.StockDate; ListViewItem.ListViewSubItem subListViewItem5 = new ListViewItem.ListViewSubItem(); subListViewItem5.Text = strText; listViewItemInfo.Column5 = strText; ListViewItem.ListViewSubItem subListViewItem6 = new ListViewItem.ListViewSubItem(); subListViewItem6.ForeColor = Color.Blue; switch ( srPointType ) { case SRStaticData.SRPointType.DCHP: subListViewItem6.Text = "LHKN(L)" + srStaticInfo.LeftKLineNumber.ToString(); listViewItemInfo.Column6 = subListViewItem6.Text; break; case SRStaticData.SRPointType.DCLP: subListViewItem6.Text = "HLKN(L)" + srStaticInfo.LeftKLineNumber.ToString(); listViewItemInfo.Column6 = subListViewItem6.Text; break; case SRStaticData.SRPointType.GULK: subListViewItem6.Text = "GPS↑ " + strGPS + "%"; listViewItemInfo.Column6 = subListViewItem6.Text; break; case SRStaticData.SRPointType.GUHK: subListViewItem6.Text = "GPS↑ " + srStaticInfo.GapPriceSpace.ToString() + "%"; listViewItemInfo.Column6 = subListViewItem6.Text; break; case SRStaticData.SRPointType.GDLK: subListViewItem6.Text = "GPS↓ " + srStaticInfo.GapPriceSpace.ToString() + "%"; listViewItemInfo.Column6 = subListViewItem6.Text; break; case SRStaticData.SRPointType.GDHK: subListViewItem6.Text = "GPS↓ " + strGPS + "%"; listViewItemInfo.Column6 = subListViewItem6.Text; break; default: subListViewItem6.Text = string.Empty; break; } ListViewItem.ListViewSubItem subListViewItem7 = new ListViewItem.ListViewSubItem(); subListViewItem7.ForeColor = Color.Blue; switch ( srPointType ) { case SRStaticData.SRPointType.DCHP: subListViewItem7.Text = "LHKN(R)" + srStaticInfo.RightLineNumber.ToString(); listViewItemInfo.Column7 = subListViewItem7.Text; break; case SRStaticData.SRPointType.DCLP: subListViewItem7.Text = "HLKN(R)" + srStaticInfo.RightLineNumber.ToString(); listViewItemInfo.Column7 = subListViewItem7.Text; break; case SRStaticData.SRPointType.GULK: subListViewItem7.Text = "VG " + strVG + "%"; listViewItemInfo.Column7 = subListViewItem7.Text; break; case SRStaticData.SRPointType.GUHK: strVG = srStaticInfo.GapVolumePercentum > 0 ? ( "+" + srStaticInfo.GapVolumePercentum.ToString() ) : srStaticInfo.GapVolumePercentum.ToString(); subListViewItem7.Text = "VG " + strVG + "%"; listViewItemInfo.Column7 = subListViewItem7.Text; break; case SRStaticData.SRPointType.GDLK: strVG = srStaticInfo.GapVolumePercentum > 0 ? ( "+" + srStaticInfo.GapVolumePercentum.ToString() ) : srStaticInfo.GapVolumePercentum.ToString(); subListViewItem7.Text = "VG " + strVG + "%"; listViewItemInfo.Column7 = subListViewItem7.Text; break; case SRStaticData.SRPointType.GDHK: subListViewItem7.Text = "VG " + strVG + "%"; listViewItemInfo.Column7 = subListViewItem7.Text; break; default: subListViewItem7.Text = string.Empty; break; } ListViewItem.ListViewSubItem subListViewItem8 = new ListViewItem.ListViewSubItem(); subListViewItem8.Text = ( srStaticInfo.RelativelyPercent * 100 ).ToString() + "%"; listViewItemInfo.Column8 = srStaticInfo.RelativelyPercent * 100; ListViewItem.ListViewSubItem subListViewItem9 = new ListViewItem.ListViewSubItem(); subListViewItem9.Text = srStaticInfo.RelativelyNumber.ToString(); listViewItemInfo.Column9 = srStaticInfo.RelativelyNumber; listViewItem.SubItems.Add( subListViewItem1 ); listViewItem.SubItems.Add( subListViewItem2 ); listViewItem.SubItems.Add( subListViewItem3 ); listViewItem.SubItems.Add( subListViewItem4 ); listViewItem.SubItems.Add( subListViewItem5 ); listViewItem.SubItems.Add( subListViewItem6 ); listViewItem.SubItems.Add( subListViewItem7 ); listViewItem.SubItems.Add( subListViewItem8 ); listViewItem.SubItems.Add( subListViewItem9 ); this.ListView.Items.Add( listViewItem ); m_ListViewItemInfo.Add( listViewItem, listViewItemInfo ); }
private void InsertMain( SRStaticData.StockData stockData, float fSRCK_R, float fSRCK_RV, float fSRCK_S, float fSRCK_SV, DateTime dateTime ) { ListViewItemInfo listViewItemInfo = new ListViewItemInfo(); ListViewItem listViewItem = new ListViewItem( "SRCK-R" ); listViewItem.ForeColor = Color.Red; listViewItemInfo.Column = -2; ListViewItem.ListViewSubItem subListViewItem1 = new ListViewItem.ListViewSubItem(); subListViewItem1.Text = string.Empty; listViewItemInfo.Column1 = MSFL.FormatPrice( stockData.StockClose ) - 0.002F; ListViewItem.ListViewSubItem subListViewItem2 = new ListViewItem.ListViewSubItem(); subListViewItem2.Text = string.Empty; //subListViewItem2.Text = fSRCK_SV.ToString(); listViewItemInfo.Column2 = fSRCK_SV + 0.002F; ListViewItem.ListViewSubItem subListViewItem3 = new ListViewItem.ListViewSubItem(); subListViewItem3.Text = fSRCK_R.ToString() + "%"; listViewItemInfo.Column3 = fSRCK_RV - 0.006F; ListViewItem.ListViewSubItem subListViewItem4 = new ListViewItem.ListViewSubItem(); subListViewItem4.Text = string.Empty; listViewItemInfo.Column4 = dateTime - TimeSpan.FromHours( 1.0 ); ListViewItem.ListViewSubItem subListViewItem5 = new ListViewItem.ListViewSubItem(); subListViewItem5.Text = string.Empty; ListViewItem.ListViewSubItem subListViewItem6 = new ListViewItem.ListViewSubItem(); subListViewItem6.Text = string.Empty; ListViewItem.ListViewSubItem subListViewItem7 = new ListViewItem.ListViewSubItem(); subListViewItem7.Text = string.Empty; ListViewItem.ListViewSubItem subListViewItem8 = new ListViewItem.ListViewSubItem(); subListViewItem8.Text = string.Empty; listViewItemInfo.Column8 = -2; ListViewItem.ListViewSubItem subListViewItem9 = new ListViewItem.ListViewSubItem(); subListViewItem9.Text = string.Empty; listViewItemInfo.Column9 = -2; listViewItem.SubItems.Add( subListViewItem1 ); listViewItem.SubItems.Add( subListViewItem2 ); listViewItem.SubItems.Add( subListViewItem3 ); listViewItem.SubItems.Add( subListViewItem4 ); listViewItem.SubItems.Add( subListViewItem5 ); listViewItem.SubItems.Add( subListViewItem6 ); listViewItem.SubItems.Add( subListViewItem7 ); listViewItem.SubItems.Add( subListViewItem8 ); listViewItem.SubItems.Add( subListViewItem9 ); this.ListView.Items.Add( listViewItem ); m_ListViewItemInfo.Add( listViewItem, listViewItemInfo ); listViewItemInfo = new ListViewItemInfo(); listViewItem = new ListViewItem( "CK" ); listViewItem.ForeColor = Color.Blue; listViewItemInfo.Column = -1; subListViewItem1 = new ListViewItem.ListViewSubItem(); subListViewItem1.Text = MSFL.FormatPrice( stockData.StockClose ).ToString(); listViewItemInfo.Column1 = MSFL.FormatPrice( stockData.StockClose ); subListViewItem2 = new ListViewItem.ListViewSubItem(); subListViewItem2.Text = string.Empty; //subListViewItem2.Text = MSFL.FormatPrice( stockData.StockLow ).ToString(); listViewItemInfo.Column2 = fSRCK_SV + 0.004F; subListViewItem3 = new ListViewItem.ListViewSubItem(); subListViewItem3.Text = string.Empty; //subListViewItem3.Text = MSFL.FormatPrice( stockData.StockHigh ).ToString(); listViewItemInfo.Column3 = fSRCK_RV - 0.004F; subListViewItem4 = new ListViewItem.ListViewSubItem(); subListViewItem4.Text = stockData.StockDate.ToShortDateString(); listViewItemInfo.Column4 = dateTime; subListViewItem5 = new ListViewItem.ListViewSubItem(); subListViewItem5.Text = stockData.StockOpen > stockData.StockClose ? "↘" : "↗"; subListViewItem6 = new ListViewItem.ListViewSubItem(); subListViewItem6.Text = string.Empty; subListViewItem7 = new ListViewItem.ListViewSubItem(); subListViewItem7.Text = string.Empty; subListViewItem8 = new ListViewItem.ListViewSubItem(); subListViewItem8.Text = string.Empty; listViewItemInfo.Column8 = -1; subListViewItem9 = new ListViewItem.ListViewSubItem(); subListViewItem9.Text = string.Empty; listViewItemInfo.Column9 = -1; listViewItem.SubItems.Add( subListViewItem1 ); listViewItem.SubItems.Add( subListViewItem2 ); listViewItem.SubItems.Add( subListViewItem3 ); listViewItem.SubItems.Add( subListViewItem4 ); listViewItem.SubItems.Add( subListViewItem5 ); listViewItem.SubItems.Add( subListViewItem6 ); listViewItem.SubItems.Add( subListViewItem7 ); listViewItem.SubItems.Add( subListViewItem8 ); listViewItem.SubItems.Add( subListViewItem9 ); this.ListView.Items.Add( listViewItem ); m_ListViewItemInfo.Add( listViewItem, listViewItemInfo ); listViewItemInfo = new ListViewItemInfo(); listViewItem = new ListViewItem( "SRCK-S" ); listViewItem.ForeColor = Color.Green; listViewItemInfo.Column = 0; subListViewItem1 = new ListViewItem.ListViewSubItem(); subListViewItem1.Text = string.Empty; listViewItemInfo.Column1 = MSFL.FormatPrice( stockData.StockClose ) + 0.002F; subListViewItem2 = new ListViewItem.ListViewSubItem(); subListViewItem2.Text = fSRCK_S.ToString() + "%"; listViewItemInfo.Column2 = fSRCK_SV + 0.006F; subListViewItem3 = new ListViewItem.ListViewSubItem(); subListViewItem3.Text = string.Empty; //subListViewItem3.Text = fSRCK_RV.ToString(); listViewItemInfo.Column3 = fSRCK_RV - 0.002F; subListViewItem4 = new ListViewItem.ListViewSubItem(); subListViewItem4.Text = string.Empty; listViewItemInfo.Column4 = dateTime + TimeSpan.FromHours( 1.0 ); subListViewItem5 = new ListViewItem.ListViewSubItem(); subListViewItem5.Text = string.Empty; subListViewItem6 = new ListViewItem.ListViewSubItem(); subListViewItem6.Text = string.Empty; subListViewItem7 = new ListViewItem.ListViewSubItem(); subListViewItem7.Text = string.Empty; subListViewItem8 = new ListViewItem.ListViewSubItem(); subListViewItem8.Text = string.Empty; listViewItemInfo.Column8 = 0; subListViewItem9 = new ListViewItem.ListViewSubItem(); subListViewItem9.Text = string.Empty; listViewItemInfo.Column9 = 0; listViewItem.SubItems.Add( subListViewItem1 ); listViewItem.SubItems.Add( subListViewItem2 ); listViewItem.SubItems.Add( subListViewItem3 ); listViewItem.SubItems.Add( subListViewItem4 ); listViewItem.SubItems.Add( subListViewItem5 ); listViewItem.SubItems.Add( subListViewItem6 ); listViewItem.SubItems.Add( subListViewItem7 ); listViewItem.SubItems.Add( subListViewItem8 ); listViewItem.SubItems.Add( subListViewItem9 ); this.ListView.Items.Add( listViewItem ); m_ListViewItemInfo.Add( listViewItem, listViewItemInfo ); }