[Quantproject-developers] QuantProject/b7_Scripts/ArbitrageTesting/OverReactionHypothesis/SimpleOHT
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2007-08-29 09:40:21
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/ArbitrageTesting/OverReactionHypothesis/SimpleOHTest In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv8862/b7_Scripts/ArbitrageTesting/OverReactionHypothesis/SimpleOHTest Modified Files: EndOfDayTimerHandlerSimpleOHTest.cs RunSimpleOHTest.cs Log Message: Minor changes to the strategy based on the simple over reaction hypothesis Index: RunSimpleOHTest.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/ArbitrageTesting/OverReactionHypothesis/SimpleOHTest/RunSimpleOHTest.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RunSimpleOHTest.cs 9 Apr 2007 18:23:49 -0000 1.1 --- RunSimpleOHTest.cs 29 Aug 2007 09:40:11 -0000 1.2 *************** *** 37,47 **** /// Script that implements the SimpleOHTest strategy: /// at each open, l long positions and s short positions will be open, ! /// buying and shorting, accordingly, the l tickers among the ! /// b best that more moves down (at open) and the s tickers among the w worst ! /// that more moves up (at open). /// The fundamental of the strategy should be the fact (to be verified ...) ! /// that overreactions may be followed by opposite overreactions. ! /// For chosing the b best and w worst tickers it is considered just the ! /// previous close. /// At each close, open positions are closed. /// </summary> --- 37,47 ---- /// Script that implements the SimpleOHTest strategy: /// at each open, l long positions and s short positions will be open, ! /// buying and shorting, accordingly, the l worst tickers ! /// and the s best tickers. ! /// For chosing the best and worst tickers just the ! /// previous close to close ratio is considered. /// The fundamental of the strategy should be the fact (to be verified ...) ! /// that great moves are probably overreactions that may be followed by opposite moves (corrections). ! /// At each close, open positions are closed. /// </summary> *************** *** 53,58 **** private string benchmark; private int numberOfEligibleTickers; ! private int numOfBestTickers; ! private int numOfWorstTickers; private int numOfTickersForBuying; private int numOfTickersForShortSelling; --- 53,57 ---- private string benchmark; private int numberOfEligibleTickers; ! private int lengthInDaysForPerformance; private int numOfTickersForBuying; private int numOfTickersForShortSelling; *************** *** 66,71 **** public RunSimpleOHTest(string tickerGroupID, string benchmark, ! int numberOfEligibleTickers, int numOfBestTickers, ! int numOfWorstTickers, int numOfTickersForBuying, int numOfTickersForShortSelling, DateTime startDate, DateTime endDate, --- 65,70 ---- public RunSimpleOHTest(string tickerGroupID, string benchmark, ! int numberOfEligibleTickers, int lengthInDaysForPerformance, ! int numOfTickersForBuying, int numOfTickersForShortSelling, DateTime startDate, DateTime endDate, *************** *** 75,80 **** this.benchmark = benchmark; this.numberOfEligibleTickers = numberOfEligibleTickers; ! this.numOfBestTickers = numOfBestTickers; ! this.numOfWorstTickers = numOfWorstTickers; this.numOfTickersForBuying = numOfTickersForBuying; this.numOfTickersForShortSelling = numOfTickersForShortSelling; --- 74,78 ---- this.benchmark = benchmark; this.numberOfEligibleTickers = numberOfEligibleTickers; ! this.lengthInDaysForPerformance = lengthInDaysForPerformance; this.numOfTickersForBuying = numOfTickersForBuying; this.numOfTickersForShortSelling = numOfTickersForShortSelling; *************** *** 83,87 **** this.maxRunningHours = maxRunningHours; this.scriptName = "SimpleOHTest"; ! this.historicalQuoteProvider = new HistoricalRawQuoteProvider(); this.endOfDayTimer = new IndexBasedEndOfDayTimer( new EndOfDayDateTime( this.startDate , --- 81,86 ---- this.maxRunningHours = maxRunningHours; this.scriptName = "SimpleOHTest"; ! // this.historicalQuoteProvider = new HistoricalRawQuoteProvider(); ! this.historicalQuoteProvider = new HistoricalAdjustedQuoteProvider(); this.endOfDayTimer = new IndexBasedEndOfDayTimer( new EndOfDayDateTime( this.startDate , *************** *** 93,109 **** { this.startingTimeForScript = DateTime.Now; ! this.account = new Account( "SimpleOH" , this.endOfDayTimer , new HistoricalEndOfDayDataStreamer( this.endOfDayTimer , this.historicalQuoteProvider ) , new HistoricalEndOfDayOrderExecutor( this.endOfDayTimer , this.historicalQuoteProvider ) ); ! EndOfDayTimerHandlerSimpleOHTest endOfDayTimerHandler = new EndOfDayTimerHandlerSimpleOHTest(this.tickerGroupID, this.numberOfEligibleTickers, ! this.numOfBestTickers, this.numOfWorstTickers, ! this.numOfTickersForBuying, this.numOfTickersForShortSelling, this.account, this.benchmark); ! this.endOfDayTimer.MarketOpen += new MarketOpenEventHandler( ! endOfDayTimerHandler.MarketOpenEventHandler ); ! this.endOfDayTimer.MarketClose += new MarketCloseEventHandler( endOfDayTimerHandler.MarketCloseEventHandler ); --- 92,107 ---- { this.startingTimeForScript = DateTime.Now; ! ! this.account = new Account( "SimpleOH" , this.endOfDayTimer , new HistoricalEndOfDayDataStreamer( this.endOfDayTimer , this.historicalQuoteProvider ) , new HistoricalEndOfDayOrderExecutor( this.endOfDayTimer , this.historicalQuoteProvider ) ); ! ! EndOfDayTimerHandlerSimpleOHTest endOfDayTimerHandler = new EndOfDayTimerHandlerSimpleOHTest(this.tickerGroupID, this.numberOfEligibleTickers, ! this.lengthInDaysForPerformance, this.numOfTickersForBuying, this.numOfTickersForShortSelling, this.account, this.benchmark); ! this.endOfDayTimer.MarketClose += new MarketCloseEventHandler( endOfDayTimerHandler.MarketCloseEventHandler ); *************** *** 111,117 **** this.endOfDayTimer.MarketClose += new MarketCloseEventHandler( this.checkDateForReport); - - this.endOfDayTimer.OneHourAfterMarketClose += new OneHourAfterMarketCloseEventHandler( - endOfDayTimerHandler.OneHourAfterMarketCloseEventHandler ); this.endOfDayTimer.Start(); --- 109,112 ---- *************** *** 135,146 **** public void SaveScriptResults() { ! string fileName = DateTime.Now.Hour.ToString().PadLeft(2,'0') + "_" + DateTime.Now.Minute.ToString().PadLeft(2,'0') + "_" + this.scriptName + "_From_" + this.tickerGroupID + "_elig_" + this.numberOfEligibleTickers + ! "_best_" + this.numOfBestTickers + ! "_worst_" + this.numOfWorstTickers + ! "_forLong_" + this.numOfTickersForBuying + ! "_forShort_" + this.numOfTickersForShortSelling; string dirNameWhereToSaveReports = System.Configuration.ConfigurationSettings.AppSettings["ReportsArchive"] + "\\" + this.scriptName + "\\"; --- 130,146 ---- public void SaveScriptResults() { ! TimeSpan span; ! span = DateTime.Now.Subtract(this.startingTimeForScript); ! int secondsElapsed = span.Hours * 3600 + span.Minutes * 60 + span.Seconds; ! string fileName = ! "SecondsElapsed_" + ! secondsElapsed.ToString() + "_" + ! DateTime.Now.Hour.ToString().PadLeft(2,'0') + "_" + DateTime.Now.Minute.ToString().PadLeft(2,'0') + "_" + this.scriptName + "_From_" + this.tickerGroupID + "_elig_" + this.numberOfEligibleTickers + ! "_Long_" + this.numOfTickersForBuying + ! "_Short_" + this.numOfTickersForShortSelling + ! "_lenInDays_" + this.lengthInDaysForPerformance; string dirNameWhereToSaveReports = System.Configuration.ConfigurationSettings.AppSettings["ReportsArchive"] + "\\" + this.scriptName + "\\"; *************** *** 150,155 **** this.endOfDayTimer.GetCurrentTime(), this.benchmark, ! new HistoricalRawQuoteProvider() ); ! // new HistoricalAdjustedQuoteProvider()); this.checkDateForReport_createDirIfNotPresent(dirNameWhereToSaveReports); ObjectArchiver.Archive(accountReport, --- 150,155 ---- this.endOfDayTimer.GetCurrentTime(), this.benchmark, ! // new HistoricalRawQuoteProvider() ); ! new HistoricalAdjustedQuoteProvider()); this.checkDateForReport_createDirIfNotPresent(dirNameWhereToSaveReports); ObjectArchiver.Archive(accountReport, Index: EndOfDayTimerHandlerSimpleOHTest.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/ArbitrageTesting/OverReactionHypothesis/SimpleOHTest/EndOfDayTimerHandlerSimpleOHTest.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** EndOfDayTimerHandlerSimpleOHTest.cs 7 Aug 2007 16:44:43 -0000 1.2 --- EndOfDayTimerHandlerSimpleOHTest.cs 29 Aug 2007 09:40:11 -0000 1.3 *************** *** 46,64 **** private string tickerGroupID; private int numberOfEligibleTickers; private string benchmark; private Account account; - private int numOfWorstTickers; - private int numOfBestTickers; private int numOfTickersForBuying; private int numOfTickersForShortSelling; ! private string[] bestTickers; ! private string[] worstTickers; private string[] chosenTickers; private string[] lastOrderedTickers; private ArrayList orders; ! public EndOfDayTimerHandlerSimpleOHTest(string tickerGroupID, int numberOfEligibleTickers, ! int numOfBestTickers, ! int numOfWorstTickers, int numOfTickersForBuying, int numOfTickersForShortSelling, Account account, string benchmark) --- 46,67 ---- private string tickerGroupID; private int numberOfEligibleTickers; + private int lengthInDaysForPerformance; private string benchmark; private Account account; private int numOfTickersForBuying; private int numOfTickersForShortSelling; ! private string[] bestTickers = null; ! private string[] worstTickers = null; private string[] chosenTickers; private string[] lastOrderedTickers; private ArrayList orders; + private bool thereAreEnoughBestTickers; + private bool thereAreEnoughWorstTickers; + private int closesElapsedWithSomeOpenPosition; + ! public EndOfDayTimerHandlerSimpleOHTest(string tickerGroupID, int numberOfEligibleTickers, ! int lengthInDaysForPerformance, ! int numOfTickersForBuying, int numOfTickersForShortSelling, Account account, string benchmark) *************** *** 66,75 **** this.tickerGroupID = tickerGroupID; this.numberOfEligibleTickers = numberOfEligibleTickers; this.account = account; this.benchmark = benchmark; - this.numOfBestTickers = numOfBestTickers; - this.bestTickers = new string[this.numOfBestTickers]; - this.numOfWorstTickers = numOfWorstTickers; - this.worstTickers = new string[this.numOfWorstTickers]; this.numOfTickersForBuying = numOfTickersForBuying; this.numOfTickersForShortSelling = numOfTickersForShortSelling; --- 69,75 ---- this.tickerGroupID = tickerGroupID; this.numberOfEligibleTickers = numberOfEligibleTickers; + this.lengthInDaysForPerformance = lengthInDaysForPerformance; this.account = account; this.benchmark = benchmark; this.numOfTickersForBuying = numOfTickersForBuying; this.numOfTickersForShortSelling = numOfTickersForShortSelling; *************** *** 116,187 **** this.account.AddOrder((Order)item); } - - private double setChosenTickers_getGainOrLossFromPreviousClose(string signedTicker) - { - IndexBasedEndOfDayTimer currentTimer = (IndexBasedEndOfDayTimer)this.account.EndOfDayTimer; - ExtendedDateTime nowAtOpen = - new ExtendedDateTime(currentTimer.GetCurrentTime().DateTime, - BarComponent.Open); - ExtendedDateTime previousClose = - new ExtendedDateTime(currentTimer.GetPreviousDateTime(), - BarComponent.Close); - double currentValueAtOpen = - HistoricalDataProvider.GetAdjustedMarketValue(SignedTicker.GetTicker(signedTicker), nowAtOpen); - double previousValueAtClose = - HistoricalDataProvider.GetAdjustedMarketValue(SignedTicker.GetTicker(signedTicker), previousClose); - - return (currentValueAtOpen - previousValueAtClose) / previousValueAtClose; - } private void setChosenTickers_addTickersForShorting() { ! DataTable worstTickersOrderedByGainAtOpen = new DataTable(); ! worstTickersOrderedByGainAtOpen.Columns.Add("ticker", Type.GetType("System.String")); ! worstTickersOrderedByGainAtOpen.Columns.Add("gainAtOpen", Type.GetType("System.Double")); ! object[] values = new object[2]; ! for (int i = 0; i<this.worstTickers.Length; i++) ! { ! values[0] = this.worstTickers[i]; ! values[1] = this.setChosenTickers_getGainOrLossFromPreviousClose(this.worstTickers[i]); ! worstTickersOrderedByGainAtOpen.Rows.Add(values); ! } ! DataRow[] orderedRows = new DataRow[this.bestTickers.Length]; ! orderedRows = worstTickersOrderedByGainAtOpen.Select("", "gainAtOpen DESC"); ! for(int i = 0;i<this.numOfTickersForBuying; i++) ! if( (double)orderedRows[i]["gainAtOpen"] > 0 ) ! //at open, current ticker is gaining ! this.chosenTickers[this.numOfTickersForBuying + i] = "-" + ! (string)orderedRows[i]["ticker"]; } private void setChosenTickers_addTickersForBuying() { ! DataTable bestTickersOrderedByLossAtOpen = new DataTable(); ! bestTickersOrderedByLossAtOpen.Columns.Add("ticker", Type.GetType("System.String")); ! bestTickersOrderedByLossAtOpen.Columns.Add("lossAtOpen", Type.GetType("System.Double")); ! object[] values = new object[2]; ! for (int i = 0; i<this.bestTickers.Length; i++) ! { ! values[0] = this.bestTickers[i]; ! values[1] = - this.setChosenTickers_getGainOrLossFromPreviousClose(this.bestTickers[i]); ! bestTickersOrderedByLossAtOpen.Rows.Add(values); ! } ! DataRow[] orderedRows = new DataRow[this.bestTickers.Length]; ! orderedRows = bestTickersOrderedByLossAtOpen.Select("", "lossAtOpen DESC"); ! for( int i = 0; i<this.numOfTickersForShortSelling; i++) ! if( (double)orderedRows[i]["lossAtOpen"] > 0 ) ! //at open, current ticker is losing ! this.chosenTickers[i] = (string)orderedRows[i]["ticker"]; } ! private void setChosenTickers() { ! for(int i = 0; i<this.chosenTickers.Length;i++) ! this.chosenTickers[i] = null; ! if( this.bestTickers[0] != null && ! this.worstTickers[0] != null ) { ! this.setChosenTickers_addTickersForBuying(); ! this.setChosenTickers_addTickersForShorting(); } } --- 116,144 ---- this.account.AddOrder((Order)item); } private void setChosenTickers_addTickersForShorting() { ! for( int i = 0;i<this.numOfTickersForShortSelling; i++) ! this.chosenTickers[this.numOfTickersForBuying + i] = "-" + this.bestTickers[i]; } private void setChosenTickers_addTickersForBuying() { ! for( int i = 0; i<this.numOfTickersForBuying; i++ ) ! this.chosenTickers[i] = this.worstTickers[i]; } ! private void setChosenTickersBothForLongAndShort() { ! if( this.thereAreEnoughBestTickers && ! this.thereAreEnoughWorstTickers ) { ! try ! { ! this.setChosenTickers_addTickersForBuying(); ! this.setChosenTickers_addTickersForShorting(); ! } ! catch(Exception ex) ! {ex = ex;} } } *************** *** 195,209 **** Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { ! if(this.orders.Count == 0 && this.account.Transactions.Count == 0) ! this.account.AddCash(30000); ! this.setChosenTickers(); ! bool allTickerHasBeenChosen = true; ! for( int i = 0; i<this.chosenTickers.Length; i++) ! { ! if(this.chosenTickers[i] == null) ! allTickerHasBeenChosen = false; ! } ! if(allTickerHasBeenChosen) ! this.openPositions(this.chosenTickers); } --- 152,166 ---- Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { ! if(this.orders.Count == 0 && this.account.Transactions.Count == 0) ! this.account.AddCash(30000); ! this.setChosenTickersBothForLongAndShort(); ! bool allTickersHasBeenChosenForLongAndShort = true; ! for( int i = 0; i<this.chosenTickers.Length; i++) ! { ! if(this.chosenTickers[i] == null) ! allTickersHasBeenChosenForLongAndShort = false; ! } ! if(allTickersHasBeenChosenForLongAndShort) ! this.openPositions(this.chosenTickers); } *************** *** 229,233 **** Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { ! this.closePositions(); } --- 186,208 ---- Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { ! if(this.account.Portfolio.Count > 0) ! { ! this.closesElapsedWithSomeOpenPosition++; ! if(this.closesElapsedWithSomeOpenPosition == this.lengthInDaysForPerformance) ! { ! this.closePositions(); ! this.OneHourAfterMarketCloseEventHandler(sender,endOfDayTimingEventArgs); ! this.MarketOpenEventHandler(sender, endOfDayTimingEventArgs); ! this.closesElapsedWithSomeOpenPosition = 0; ! } ! } ! else//this.account.Portfolio.Count == 0 ! { ! if( ((IndexBasedEndOfDayTimer)sender).CurrentDateArrayPosition >= this.lengthInDaysForPerformance ) ! { ! this.OneHourAfterMarketCloseEventHandler(sender,endOfDayTimingEventArgs); ! this.MarketOpenEventHandler(sender, endOfDayTimingEventArgs); ! } ! } } *************** *** 235,239 **** #region OneHourAfterMarketCloseEventHandler ! /// <summary> /// Handles a "One hour after market close" event. --- 210,225 ---- #region OneHourAfterMarketCloseEventHandler ! ! private void oneHourAfterMarketCloseEventHandler_clear() ! { ! this.orders.Clear(); ! this.thereAreEnoughBestTickers = false; ! this.thereAreEnoughWorstTickers = false; ! ! for(int i = 0; i<this.chosenTickers.Length;i++) ! this.chosenTickers[i] = null; ! } ! ! /// <summary> /// Handles a "One hour after market close" event. *************** *** 244,291 **** Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { ! this.orders.Clear(); ! DateTime currentDate = endOfDayTimingEventArgs.EndOfDayDateTime.DateTime; ! SelectorByGroup temporizedGroup = new SelectorByGroup(this.tickerGroupID, ! currentDate); ! DataTable tickersFromGroup = temporizedGroup.GetTableOfSelectedTickers(); ! //remark from here for DEBUG ! SelectorByAverageRawOpenPrice byPrice = ! new SelectorByAverageRawOpenPrice( tickersFromGroup,false,currentDate.AddDays(-10), ! currentDate, ! tickersFromGroup.Rows.Count, ! 25 ); ! SelectorByLiquidity mostLiquidSelector = ! new SelectorByLiquidity(byPrice.GetTableOfSelectedTickers(), ! false,currentDate.AddDays(-30), currentDate, ! this.numberOfEligibleTickers); ! SelectorByOpenToCloseVolatility lessVolatile = ! new SelectorByOpenToCloseVolatility(mostLiquidSelector.GetTableOfSelectedTickers(), ! true,currentDate.AddDays(-30), currentDate, ! this.numberOfEligibleTickers/2); ! SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromMostLiquid = ! new SelectorByQuotationAtEachMarketDay(lessVolatile.GetTableOfSelectedTickers(), ! false, currentDate.AddDays(-30), currentDate, ! this.numberOfEligibleTickers/2, this.benchmark); ! ! SelectorByAverageCloseToClosePerformance bestTickersFromQuoted = ! new SelectorByAverageCloseToClosePerformance(quotedAtEachMarketDayFromMostLiquid.GetTableOfSelectedTickers(), ! false,currentDate,currentDate,this.bestTickers.Length); ! ! SelectorByAverageCloseToClosePerformance worstTickersFromQuoted = ! new SelectorByAverageCloseToClosePerformance(quotedAtEachMarketDayFromMostLiquid.GetTableOfSelectedTickers(), ! true,currentDate,currentDate,this.worstTickers.Length); ! DataTable tableOfBestTickers = bestTickersFromQuoted.GetTableOfSelectedTickers(); ! for(int i = 0;i<this.bestTickers.Length;i++) ! if(tableOfBestTickers.Rows[i][0] != null) ! this.bestTickers[i] = (string)tableOfBestTickers.Rows[i][0]; ! DataTable tableOfWorstTickers = worstTickersFromQuoted.GetTableOfSelectedTickers(); ! for(int i = 0;i<this.worstTickers.Length;i++) ! if(tableOfWorstTickers.Rows[i][0] != null) ! this.worstTickers[i] = (string)tableOfWorstTickers.Rows[i][0]; // //for DEBUG // //remark from here for real running --- 230,296 ---- Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { ! this.oneHourAfterMarketCloseEventHandler_clear(); ! DateTime currentDate = endOfDayTimingEventArgs.EndOfDayDateTime.DateTime; ! int currentDateArrayPositionInTimer = ((IndexBasedEndOfDayTimer)sender).CurrentDateArrayPosition; ! DateTime firstDateForPerformanceComputation = ! (DateTime)((IndexBasedEndOfDayTimer)sender).IndexQuotes.Rows[currentDateArrayPositionInTimer - this.lengthInDaysForPerformance]["quDate"]; ! SelectorByGroup temporizedGroup = new SelectorByGroup(this.tickerGroupID, ! currentDate); ! DataTable tickersFromGroup = temporizedGroup.GetTableOfSelectedTickers(); ! //remark from here for DEBUG ! SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromGroup = ! new SelectorByQuotationAtEachMarketDay(tickersFromGroup, ! false, currentDate.AddDays(-30), currentDate, ! tickersFromGroup.Rows.Count, this.benchmark); ! ! SelectorByAverageRawOpenPrice byPrice = ! new SelectorByAverageRawOpenPrice( quotedAtEachMarketDayFromGroup.GetTableOfSelectedTickers(), ! false, currentDate.AddDays(-10), currentDate, ! tickersFromGroup.Rows.Count, 25 ); ! SelectorByLiquidity mostLiquidSelector = ! new SelectorByLiquidity(byPrice.GetTableOfSelectedTickers(), ! false,currentDate.AddDays(-30), currentDate, ! this.numberOfEligibleTickers); ! ! SelectorByCloseToCloseVolatility lessVolatile = ! new SelectorByCloseToCloseVolatility(mostLiquidSelector.GetTableOfSelectedTickers(), ! true,currentDate.AddDays(-30), currentDate, ! this.numberOfEligibleTickers/2); ! SelectorByAbsolutePerformance bestTickersFromLessVolatile = ! new SelectorByAbsolutePerformance(lessVolatile.GetTableOfSelectedTickers(), ! false,firstDateForPerformanceComputation,currentDate,this.bestTickers.Length); ! SelectorByAbsolutePerformance worstTickersFromLessVolatile = ! new SelectorByAbsolutePerformance(lessVolatile.GetTableOfSelectedTickers(), ! true,firstDateForPerformanceComputation,currentDate,this.bestTickers.Length); ! DataTable tableOfBestTickers = bestTickersFromLessVolatile.GetTableOfSelectedTickers(); ! if(tableOfBestTickers.Rows.Count >= this.bestTickers.Length) ! { ! this.thereAreEnoughBestTickers = true; ! for(int i = 0;i<this.bestTickers.Length;i++) ! { ! if( (double)tableOfBestTickers.Rows[i]["SimpleReturn"] > 0.0 ) ! this.bestTickers[i] = (string)tableOfBestTickers.Rows[i][0]; ! else//not all best tickers have gained ! this.thereAreEnoughBestTickers = false; ! } ! } ! ! DataTable tableOfWorstTickers = worstTickersFromLessVolatile.GetTableOfSelectedTickers(); ! if(tableOfWorstTickers.Rows.Count >= this.worstTickers.Length) ! { ! this.thereAreEnoughWorstTickers = true; ! for(int i = 0;i<this.worstTickers.Length;i++) ! { ! if( (double)tableOfWorstTickers.Rows[i]["SimpleReturn"] < 0.0 ) ! this.worstTickers[i] = (string)tableOfWorstTickers.Rows[i][0]; ! else//not all best tickers have lost ! this.thereAreEnoughWorstTickers = false; ! } ! } // //for DEBUG // //remark from here for real running |