public void SetStockFileInfos( StockFileInfo[] stockFileInfoArray )
        {
            for ( int iIndex = 0; iIndex < stockFileInfoArray.Length; iIndex++ )
            {
                StockFileInfo stockFileInfo = stockFileInfoArray[iIndex];
                string securityInfo = GlobalSetting.GetStockCode( stockFileInfo.StockName, stockFileInfo.StockSymbol );

                ListViewItem listViewItem = new ListViewItem( stockFileInfo.StockName );
                ListViewItem.ListViewSubItem listViewSubItem1 = new ListViewItem.ListViewSubItem( listViewItem, stockFileInfo.StockSymbol );
                ListViewItem.ListViewSubItem listViewSubItem2 = new ListViewItem.ListViewSubItem( listViewItem, stockFileInfo.StockFilePath );

                listViewItem.SubItems.Add( listViewSubItem1 );
                listViewItem.SubItems.Add( listViewSubItem2 );

                bool bIsOK = true;
                foreach ( ListViewItem item in this.ListViewStock.Items )
                {
                    string securityInfo2 = GlobalSetting.GetStockCode( item.Text, item.SubItems[1].Text );

                    if ( securityInfo == securityInfo2 )
                    {
                        bIsOK = false;
                        break;
                    }
                }

                if ( bIsOK == true )
                    this.ListViewStock.Items.Add( listViewItem );
            }
        }
        public StockFileInfo[] GetStockFileInfos()
        {
            List<StockFileInfo> stockFileInfoList = new List<StockFileInfo>();

            for ( int iIndex = 0; iIndex < this.ListViewStock.Items.Count; iIndex++ )
            {
                ListViewItem listViewItem = this.ListViewStock.Items[iIndex];

                StockFileInfo stockFileInfo = new StockFileInfo();
                stockFileInfo.StockName = listViewItem.Text;
                stockFileInfo.StockSymbol = listViewItem.SubItems[1].Text;
                stockFileInfo.StockFilePath = listViewItem.SubItems[2].Text;

                stockFileInfoList.Add( stockFileInfo );
            }

            return stockFileInfoList.ToArray();
        }
예제 #3
0
        public static StockFileInfo[] LoadListing( string strConfigFile )
        {
            if ( File.Exists( strConfigFile ) == false )
                return null;

            XDocument documentConfig = XDocument.Load( strConfigFile );
            if ( documentConfig == null )
                return null;

            XElement elementRoot = documentConfig.Element( (XName)"Demo.Stock" );
            if ( elementRoot == null )
                return null;

            XAttribute attributeVer = elementRoot.Attribute( (XName)"Ver" );
            if ( attributeVer == null )
                return null;

            //////////////////////////////////////////////////////////////////////////
            // <Settings>
            IEnumerable<XElement> elementStockFileInfos = elementRoot.Elements( (XName)"StockFileInfo" );
            if ( elementStockFileInfos == null )
                return null;

            List<StockFileInfo> stockFileInfoList = new List<StockFileInfo>();

            foreach ( var elementStockFileInfo in elementStockFileInfos )
            {
                XAttribute attributeName = elementStockFileInfo.Attribute( (XName)"Name" );
                if ( attributeName == null )
                    continue;

                XAttribute attributeSymbol = elementStockFileInfo.Attribute( (XName)"Symbol" );
                if ( attributeSymbol == null )
                    continue;

                StockFileInfo stockFileInfo = new StockFileInfo();
                stockFileInfo.StockName = attributeName.Value;
                stockFileInfo.StockSymbol = attributeSymbol.Value;
                stockFileInfo.StockFilePath = elementStockFileInfo.Value;

                stockFileInfoList.Add( stockFileInfo );
            }

            return stockFileInfoList.ToArray();
        }
예제 #4
0
        public static SRDynamicData ScanSRDynamicData( StockFileInfo stockFileInfo, LHPScanInfo lhpScanInfo, SRStaticData srStaticData )
        {
            SRDynamicData srDynamicData = new SRDynamicData();



            return srDynamicData;
        }
예제 #5
0
        public static void SaveConfigSetting( string strConfigFile, StockFileInfo[] stockFileInfos )
        {
            if ( stockFileInfos == null )
                return;

            if ( File.Exists( strConfigFile ) == true )
            {
                File.SetAttributes( strConfigFile, FileAttributes.Archive );
                File.Delete( strConfigFile );
            }

            XElement elementRoot = new XElement( "Demo.Stock", new XAttribute( "Ver", "0.0.1.0" ) );

            for ( int iIndex = 0; iIndex < stockFileInfos.Length; iIndex++ )
            {
                StockFileInfo stockFileInfo = stockFileInfos[iIndex];

                XElement elementStockFileInfo = new XElement( "StockFileInfo", new XAttribute( "Name", stockFileInfo.StockName ) );
                elementStockFileInfo.Add( new XAttribute( "Symbol", stockFileInfo.StockSymbol ) );
                elementStockFileInfo.Value = stockFileInfo.StockFilePath;

                elementRoot.Add( elementStockFileInfo );
            }

            XDocument documentConfig = new XDocument( new XDeclaration( "1.0", "utf - 8", "yes" ), elementRoot );
            documentConfig.Save( strConfigFile );
        }
예제 #6
0
        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;
        }
예제 #7
0
        public static OptionFormInfo LoadOptionFormInfo( string strConfigFile )
        {
            if ( File.Exists( strConfigFile ) == false )
                return null;

            XDocument documentConfig = XDocument.Load( strConfigFile );
            if ( documentConfig == null )
                return null;

            XElement elementRoot = documentConfig.Element( (XName)"Demo.Stock" );
            if ( elementRoot == null )
                return null;

            XAttribute attributeVer = elementRoot.Attribute( (XName)"Ver" );
            if ( attributeVer == null )
                return null;

            OptionFormInfo optionFormInfo = new OptionFormInfo();

            //////////////////////////////////////////////////////////////////////////
            // <Settings>
            IEnumerable<XElement> elementStockFileInfos = elementRoot.Elements( (XName)"StockFileInfo" );
            if ( elementStockFileInfos == null )
                return null;

            List<StockFileInfo> stockFileInfoList = new List<StockFileInfo>();

            foreach ( var elementStockFileInfo in elementStockFileInfos )
            {
                XAttribute attributeName = elementStockFileInfo.Attribute( (XName)"Name" );
                if ( attributeName == null )
                    continue;

                XAttribute attributeSymbol = elementStockFileInfo.Attribute( (XName)"Symbol" );
                if ( attributeSymbol == null )
                    continue;

                StockFileInfo stockFileInfo = new StockFileInfo();
                stockFileInfo.StockName = attributeName.Value;
                stockFileInfo.StockSymbol = attributeSymbol.Value;
                stockFileInfo.StockFilePath = elementStockFileInfo.Value;

                stockFileInfoList.Add( stockFileInfo );
            }

            optionFormInfo.m_StockFileInfos = stockFileInfoList.ToArray();

            XElement elementScanBaseInfo = elementRoot.Element( (XName)"TriggerInfos" );
            if ( elementScanBaseInfo == null )
                return null;
            else
            {
                XAttribute attributeAllowTrigger = elementScanBaseInfo.Attribute( (XName)"AllowTrigger" );
                if ( attributeAllowTrigger == null )
                    return null;
                else
                    optionFormInfo.m_TriggerInfos.m_AllowTrigger = bool.Parse( attributeAllowTrigger.Value );
            }

            return optionFormInfo;
        }