[Quantproject-developers] QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOs
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2009-01-01 13:45:03
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13372/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator Modified Files: PVOStrategyIntraday.cs PVOStrategyIntradayMain.cs Log Message: Some new parameters have been added to the PVOStrategyIntraday. Index: PVOStrategyIntraday.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/PVOStrategyIntraday.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PVOStrategyIntraday.cs 23 Nov 2008 17:13:23 -0000 1.1 --- PVOStrategyIntraday.cs 1 Jan 2009 13:44:57 -0000 1.2 *************** *** 23,26 **** --- 23,27 ---- using System.Data; using System.Collections; + using System.Collections.Generic; using QuantProject.ADT; *************** *** 87,91 **** protected PVOPositionsStatus positionsForOutOfSampleStatus; - protected DateTime lastTimerDateTimeAfterLastExit; protected DateTime lastOptimizationDateTime; protected Account account; --- 88,91 ---- *************** *** 99,106 **** // private bool optimalPositionsHaveBeenUpdated; ! protected Time timeForCheckingCrossingThresholds_begin; ! protected Time timeForCheckingCrossingThresholds_end; ! protected Time timeForEntry; ! protected Time timeForExit; private string description_GetDescriptionForChooser() --- 99,112 ---- // private bool optimalPositionsHaveBeenUpdated; ! protected bool stopLossConditionReached; ! protected bool takeProfitConditionReached; ! protected double inefficiencyLengthInMinutes; ! protected double maxOpeningLengthInMinutes; ! protected Time lastEntryTime; ! protected List<Time> openingTimesForAvailableBars; ! protected double currentAccountValue; ! protected double previousAccountValue; ! protected double stopLoss; ! protected double takeProfit; private string description_GetDescriptionForChooser() *************** *** 112,115 **** --- 118,130 ---- } + private Time getLastEventTimeWithCachedBars() + { + return this.openingTimesForAvailableBars[openingTimesForAvailableBars.Count - 1]; + } + private Time getFirstEventTimeWithCachedBars() + { + return this.openingTimesForAvailableBars[0]; + } + public string Description { *************** *** 153,160 **** HistoricalMarketValueProvider historicalMarketValueProviderForInSample, HistoricalMarketValueProvider historicalMarketValueProviderForOutOfSample, ! Time timeForCheckingCrossingThresholds_begin, ! Time timeForCheckingCrossingThresholds_end, ! Time timeForEntry, ! Time timeForExit) { this.eligiblesSelector = eligiblesSelector; --- 168,175 ---- HistoricalMarketValueProvider historicalMarketValueProviderForInSample, HistoricalMarketValueProvider historicalMarketValueProviderForOutOfSample, ! double inefficiencyLengthInMinutes, ! double maxOpeningLengthInMinutes, ! List<Time> openingTimesForAvailableBars, ! double stopLoss, double takeProfit) { this.eligiblesSelector = eligiblesSelector; *************** *** 170,179 **** this.historicalMarketValueProviderForInSample = historicalMarketValueProviderForInSample; this.historicalMarketValueProviderForOutOfSample = historicalMarketValueProviderForOutOfSample; ! this.timeForCheckingCrossingThresholds_begin = timeForCheckingCrossingThresholds_begin; ! this.timeForCheckingCrossingThresholds_end = timeForCheckingCrossingThresholds_end; ! this.timeForEntry = timeForEntry; ! this.timeForExit = timeForExit; this.lastOptimizationDateTime = DateTime.MinValue; this.pvoStrategyIntraday_checkTimeParameters(); // this.optimalPositionsHaveBeenUpdated = false; } --- 185,197 ---- this.historicalMarketValueProviderForInSample = historicalMarketValueProviderForInSample; this.historicalMarketValueProviderForOutOfSample = historicalMarketValueProviderForOutOfSample; ! this.inefficiencyLengthInMinutes = inefficiencyLengthInMinutes; ! this.maxOpeningLengthInMinutes = maxOpeningLengthInMinutes; ! this.openingTimesForAvailableBars = openingTimesForAvailableBars; ! this.stopLoss = stopLoss; ! this.takeProfit = takeProfit; this.lastOptimizationDateTime = DateTime.MinValue; + this.pvoStrategyIntraday_checkTimeParameters(); + this.lastEntryTime = new Time("00:00:00"); // this.optimalPositionsHaveBeenUpdated = false; } *************** *** 191,198 **** HistoricalMarketValueProvider historicalMarketValueProviderForInSample, HistoricalMarketValueProvider historicalMarketValueProviderForOutOfSample, ! Time timeForCheckingCrossingThresholds_begin, ! Time timeForCheckingCrossingThresholds_end, ! Time timeForEntry, ! Time timeForExit) { --- 209,216 ---- HistoricalMarketValueProvider historicalMarketValueProviderForInSample, HistoricalMarketValueProvider historicalMarketValueProviderForOutOfSample, ! double inefficiencyLengthInMinutes, ! double maxOpeningLengthInMinutes, ! List<Time> openingTimesForAvailableBars, ! double stopLoss, double takeProfit) { *************** *** 203,209 **** historicalMarketValueProviderForInSample, historicalMarketValueProviderForOutOfSample, ! timeForCheckingCrossingThresholds_begin, ! timeForCheckingCrossingThresholds_end, ! timeForEntry, timeForExit); this.inSampleChooser = inSampleChooser; } --- 221,228 ---- historicalMarketValueProviderForInSample, historicalMarketValueProviderForOutOfSample, ! inefficiencyLengthInMinutes, ! maxOpeningLengthInMinutes, ! openingTimesForAvailableBars, ! stopLoss, takeProfit); this.inSampleChooser = inSampleChooser; } *************** *** 219,226 **** HistoricalMarketValueProvider historicalMarketValueProviderForInSample, HistoricalMarketValueProvider historicalMarketValueProviderForOutOfSample, ! Time timeForCheckingCrossingThresholds_begin, ! Time timeForCheckingCrossingThresholds_end, ! Time timeForEntry, ! Time timeForExit) { --- 238,245 ---- HistoricalMarketValueProvider historicalMarketValueProviderForInSample, HistoricalMarketValueProvider historicalMarketValueProviderForOutOfSample, ! double inefficiencyLengthInMinutes, ! double maxOpeningLengthInMinutes, ! List<Time> openingTimesForAvailableBars, ! double stopLoss, double takeProfit) { *************** *** 231,237 **** historicalMarketValueProviderForInSample, historicalMarketValueProviderForOutOfSample, ! timeForCheckingCrossingThresholds_begin, ! timeForCheckingCrossingThresholds_end, ! timeForEntry, timeForExit); this.inSampleChooser = inSampleChooser; } --- 250,257 ---- historicalMarketValueProviderForInSample, historicalMarketValueProviderForOutOfSample, ! inefficiencyLengthInMinutes, ! maxOpeningLengthInMinutes, ! openingTimesForAvailableBars, ! stopLoss, takeProfit); this.inSampleChooser = inSampleChooser; } *************** *** 248,255 **** HistoricalMarketValueProvider historicalMarketValueProviderForInSample, HistoricalMarketValueProvider historicalMarketValueProviderForOutOfSample, ! Time timeForCheckingCrossingThresholds_begin, ! Time timeForCheckingCrossingThresholds_end, ! Time timeForEntry, ! Time timeForExit) { --- 268,275 ---- HistoricalMarketValueProvider historicalMarketValueProviderForInSample, HistoricalMarketValueProvider historicalMarketValueProviderForOutOfSample, ! double inefficiencyLengthInMinutes, ! double maxOpeningLengthInMinutes, ! List<Time> openingTimesForAvailableBars, ! double stopLoss, double takeProfit) { *************** *** 260,266 **** historicalMarketValueProviderForInSample, historicalMarketValueProviderForOutOfSample, ! timeForCheckingCrossingThresholds_begin, ! timeForCheckingCrossingThresholds_end, ! timeForEntry, timeForExit); this.chosenPVOPositions = chosenPVOPositions; } --- 280,287 ---- historicalMarketValueProviderForInSample, historicalMarketValueProviderForOutOfSample, ! inefficiencyLengthInMinutes, ! maxOpeningLengthInMinutes, ! openingTimesForAvailableBars, ! stopLoss, takeProfit); this.chosenPVOPositions = chosenPVOPositions; } *************** *** 275,283 **** HistoricalMarketValueProvider historicalMarketValueProviderForInSample, HistoricalMarketValueProvider historicalMarketValueProviderForOutOfSample, ! Time timeForCheckingCrossingThresholds_begin, ! Time timeForCheckingCrossingThresholds_end, ! Time timeForEntry, ! Time timeForExit) ! { this.pvoStrategyIntraday(eligiblesSelector, minimumNumberOfEligiblesForValidOptimization, --- 296,303 ---- HistoricalMarketValueProvider historicalMarketValueProviderForInSample, HistoricalMarketValueProvider historicalMarketValueProviderForOutOfSample, ! double inefficiencyLengthInMinutes, ! double maxOpeningLengthInMinutes, ! List<Time> openingTimesForAvailableBars, ! double stopLoss, double takeProfit) { this.pvoStrategyIntraday(eligiblesSelector, minimumNumberOfEligiblesForValidOptimization, *************** *** 287,294 **** historicalMarketValueProviderForInSample, historicalMarketValueProviderForOutOfSample, ! timeForCheckingCrossingThresholds_begin, ! timeForCheckingCrossingThresholds_end, ! timeForEntry, ! timeForExit); this.chosenPVOPositions = chosenPVOPositions; } --- 307,314 ---- historicalMarketValueProviderForInSample, historicalMarketValueProviderForOutOfSample, ! inefficiencyLengthInMinutes, ! maxOpeningLengthInMinutes, ! openingTimesForAvailableBars, ! stopLoss, takeProfit); this.chosenPVOPositions = chosenPVOPositions; } *************** *** 399,449 **** #endregion #region newDateTimeEventHandler_closePositions ! private void newDateTimeEventHandler_closePositions() { ! AccountManager.ClosePositions( this.account ); } #endregion newDateTimeEventHandler_closePositions #region newDateTimeEventHandler_openPositions ! private void newDateTimeEventHandler_openPositions() { ! switch (this.positionsForOutOfSampleStatus) { ! case PVOPositionsStatus.Overbought: { ! #region manage Overbought case ! this.positionsForOutOfSample.WeightedPositions.Reverse(); ! try { ! AccountManager.OpenPositions( this.positionsForOutOfSample.WeightedPositions, ! this.account ); } ! catch(Exception ex) { ! string forBreakpoint = ex.Message; forBreakpoint = forBreakpoint + ""; } ! finally { ! this.positionsForOutOfSample.WeightedPositions.Reverse(); } - #endregion - break; - } - case PVOPositionsStatus.Oversold: - { - AccountManager.OpenPositions( this.positionsForOutOfSample.WeightedPositions, - this.account ); - break; - } - case PVOPositionsStatus.InTheMiddle://that is - { //pvoPositionsForOutOfSample has not been set - - break; - } - default: - { - //it should never been reached - break; } } --- 419,521 ---- #endregion + private bool allTickersAreExchanged(DateTime dateTime, + string[] tickers) + { + bool returnValue = true; + try{ + for( int i = 0; i < tickers.Length; i++ ) + { + if(!this.historicalMarketValueProviderForOutOfSample.WasExchanged( tickers[i], dateTime ) ) + { + returnValue = false; + i = tickers.Length; //exit from for + } + } + } + catch(Exception ex){ + string forBreakpoint = ex.Message; + forBreakpoint = forBreakpoint + ""; + returnValue = false; + } + return returnValue; + } + #region newDateTimeEventHandler_closePositions ! ! private void newDateTimeEventHandler_closePositions(Time currentDailyTime) { ! if( this.account.Portfolio.Count > 0 && ! (this.lastEntryTime.AddMinutes(maxOpeningLengthInMinutes) == currentDailyTime || ! this.stopLossConditionReached || this.takeProfitConditionReached ) && ! allTickersAreExchanged( this.now(), AccountManager.GetTickersInOpenedPositions(this.account) ) ) ! { ! AccountManager.ClosePositions( this.account ); ! this.lastEntryTime = new Time("00:00:00"); ! } } #endregion newDateTimeEventHandler_closePositions #region newDateTimeEventHandler_openPositions ! private void newDateTimeEventHandler_openPositions(Time currentDailyTime) { ! Time timeForClose = currentDailyTime.AddMinutes(maxOpeningLengthInMinutes); ! DateTime dateTimeForClose = Time.GetDateTimeFromMerge( this.now(), timeForClose ); ! if( this.account.Portfolio.Count == 0 && ! this.positionsForOutOfSample != null && ! timeForClose <= getLastEventTimeWithCachedBars() && ! this.allTickersAreExchanged( this.now(), this.positionsForOutOfSample.WeightedPositions.SignedTickers.Tickers ) && ! this.allTickersAreExchanged( dateTimeForClose, this.positionsForOutOfSample.WeightedPositions.SignedTickers.Tickers ) ) { ! switch (this.positionsForOutOfSampleStatus) { ! case PVOPositionsStatus.Overbought: { ! #region manage Overbought case ! this.positionsForOutOfSample.WeightedPositions.Reverse(); ! try ! { ! AccountManager.OpenPositions( this.positionsForOutOfSample.WeightedPositions, ! this.account ); ! this.lastEntryTime = currentDailyTime; ! this.previousAccountValue = this.account.GetMarketValue(); ! } ! catch(Exception ex) ! { ! string forBreakpoint = ex.Message; forBreakpoint = forBreakpoint + ""; ! } ! finally ! { ! this.positionsForOutOfSample.WeightedPositions.Reverse(); ! } ! #endregion ! break; } ! case PVOPositionsStatus.Oversold: { ! #region manage Oversold case ! try ! { ! AccountManager.OpenPositions( this.positionsForOutOfSample.WeightedPositions, ! this.account ); ! this.lastEntryTime = currentDailyTime; ! this.previousAccountValue = this.account.GetMarketValue(); ! } ! catch(Exception ex) ! { ! string forBreakpoint = ex.Message; forBreakpoint = forBreakpoint + ""; ! } ! #endregion oversold case ! break; } ! case PVOPositionsStatus.InTheMiddle://that is ! { //pvoPositionsForOutOfSample has not been set ! ! break; ! } ! default: { ! //it should never been reached ! break; } } } *************** *** 452,468 **** #region newDateTimeEventHandler_updateStatus ! private void newDateTimeEventHandler_setPositionsAndStatus() { DateTime beginOfOscillatingPeriod = ! Time.GetDateTimeFromMerge(this.now() , this.timeForCheckingCrossingThresholds_begin); DateTime endOfOscillatingPeriod = ! Time.GetDateTimeFromMerge(this.now() , this.timeForCheckingCrossingThresholds_end); for(int i = 0; i<this.chosenPVOPositions.Length; i++) { if(this.chosenPVOPositions[i] != null) ! this.positionsForOutOfSampleStatus = ! ((PVOPositions)this.chosenPVOPositions[i]).GetStatus(beginOfOscillatingPeriod, endOfOscillatingPeriod, this.benchmark.Ticker, this.historicalMarketValueProviderForOutOfSample, this.oversoldThresholdMAX, this.overboughtThresholdMAX); if(this.positionsForOutOfSampleStatus == PVOPositionsStatus.Oversold || this.positionsForOutOfSampleStatus == PVOPositionsStatus.Overbought ) --- 524,546 ---- #region newDateTimeEventHandler_updateStatus ! private void newDateTimeEventHandler_setPositionsAndStatus(Time currentDailyTime) { DateTime beginOfOscillatingPeriod = ! Time.GetDateTimeFromMerge(this.now() , currentDailyTime.AddMinutes(-inefficiencyLengthInMinutes) ); DateTime endOfOscillatingPeriod = ! Time.GetDateTimeFromMerge(this.now() , currentDailyTime); ! this.positionsForOutOfSample = null; ! this.positionsForOutOfSampleStatus = ! PVOPositionsStatus.InTheMiddle; for(int i = 0; i<this.chosenPVOPositions.Length; i++) { if(this.chosenPVOPositions[i] != null) ! try{ ! this.positionsForOutOfSampleStatus = ! ((PVOPositions)this.chosenPVOPositions[i]).GetStatus(beginOfOscillatingPeriod, endOfOscillatingPeriod, this.benchmark.Ticker, this.historicalMarketValueProviderForOutOfSample, this.oversoldThresholdMAX, this.overboughtThresholdMAX); + }catch(Exception ex){string str = ex.ToString();} + if(this.positionsForOutOfSampleStatus == PVOPositionsStatus.Oversold || this.positionsForOutOfSampleStatus == PVOPositionsStatus.Overbought ) *************** *** 475,489 **** #endregion newDateTimeEventHandler_updateStatus public virtual void NewDateTimeEventHandler( Object sender , DateTime dateTime ) { Time currentTime = new Time( dateTime ); ! if( timeForCheckingCrossingThresholds_end == currentTime ) ! this.newDateTimeEventHandler_setPositionsAndStatus(); ! else if( timeForEntry == currentTime ) ! this.newDateTimeEventHandler_openPositions(); ! else if( timeForExit == currentTime ) ! this.newDateTimeEventHandler_closePositions(); ! else if( currentTime > timeForExit ) this.newDateTimeEventHandler_updateTestingPositions( dateTime ); } --- 553,607 ---- #endregion newDateTimeEventHandler_updateStatus + #region newDateTimeEventHandler_updateStopLossAndTakeProfitConditions + protected virtual void newDateTimeEventHandler_updateStopLossAndTakeProfitConditions() + { + //this.previousAccountValue has been set at opening positions + this.stopLossConditionReached = false; + this.takeProfitConditionReached = false; + if(this.account.Portfolio.Count > 0) + { + try{ + this.currentAccountValue = this.account.GetMarketValue(); + double portfolioGainOrLoss = (this.currentAccountValue - this.previousAccountValue) + /this.previousAccountValue; + + if(!double.IsInfinity(portfolioGainOrLoss) && + portfolioGainOrLoss <= -this.stopLoss ) + { + this.stopLossConditionReached = true; + this.takeProfitConditionReached = false; + } + else if (!double.IsInfinity(portfolioGainOrLoss) && + portfolioGainOrLoss >= this.takeProfit ) + + { + this.stopLossConditionReached = false; + this.takeProfitConditionReached = true; + } + } + catch(Exception ex) + {string forBreakpoint = ex.Message; forBreakpoint = forBreakpoint + "";} + } + } + + #endregion newDateTimeEventHandler_updateStopLossAndTakeProfitConditions + public virtual void NewDateTimeEventHandler( Object sender , DateTime dateTime ) { Time currentTime = new Time( dateTime ); ! this.newDateTimeEventHandler_updateStopLossAndTakeProfitConditions(); ! this.newDateTimeEventHandler_closePositions(currentTime); ! if( currentTime < getLastEventTimeWithCachedBars() && ! currentTime >= ! getFirstEventTimeWithCachedBars().AddMinutes(inefficiencyLengthInMinutes) && ! this.chosenPVOPositions != null ) ! //it's possible to compute inefficiency and optimization ! //has been done ! { ! this.newDateTimeEventHandler_setPositionsAndStatus(currentTime); ! this.newDateTimeEventHandler_openPositions(currentTime); ! } ! if( currentTime == getLastEventTimeWithCachedBars() ) this.newDateTimeEventHandler_updateTestingPositions( dateTime ); } *************** *** 538,543 **** DateTime dateTime ) { - this.lastTimerDateTimeAfterLastExit = dateTime; - this.numDaysElapsedSinceLastOptimization++; //OLD - numDaysBetweenEachOptimization --> market days // if( this.account.Transactions.Count <= 1 || --- 656,659 ---- *************** *** 551,555 **** this.updateTestingPositions( dateTime ); //sets tickers to be chosen next time - this.numDaysElapsedSinceLastOptimization = 0; this.lastOptimizationDateTime = this.now(); } --- 667,670 ---- Index: PVOStrategyIntradayMain.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/PVOStrategyIntradayMain.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PVOStrategyIntradayMain.cs 23 Nov 2008 17:13:23 -0000 1.1 --- PVOStrategyIntradayMain.cs 1 Jan 2009 13:44:57 -0000 1.2 *************** *** 64,71 **** private HistoricalMarketValueProvider historicalMarketValueProviderForInSample; private HistoricalMarketValueProvider historicalMarketValueProviderForOutOfSample; ! private Time timeForCheckingCrossingThreshold_begin; ! private Time timeForCheckingCrossingThreshold_end; ! private Time timeForEntry; ! private Time timeForExit; private Timer timerForBackTester; private DateTime firstDateTime; --- 64,69 ---- private HistoricalMarketValueProvider historicalMarketValueProviderForInSample; private HistoricalMarketValueProvider historicalMarketValueProviderForOutOfSample; ! private double inefficiencyLengthInMinutes; ! private double maxOpeningLengthInMinutes; private Timer timerForBackTester; private DateTime firstDateTime; *************** *** 76,89 **** { //this.benchmark = new Benchmark( "^GSPC" ); ! this.timeForCheckingCrossingThreshold_begin = ! new Time("10:00:00"); ! this.timeForCheckingCrossingThreshold_end = ! new Time("11:00:00"); ! this.timeForEntry = this.timeForCheckingCrossingThreshold_end; ! // new Time("11:01:00"); ! this.timeForExit = ! new Time("12:00:00"); ! this.firstDateTime = new DateTime( 2007 , 1 , 1 ); ! this.lastDateTime = new DateTime( 2007 , 1, 31 ); this.intervalFrameInSeconds = 60; this.benchmark = new Benchmark( "MSFT" ); --- 74,82 ---- { //this.benchmark = new Benchmark( "^GSPC" ); ! this.inefficiencyLengthInMinutes = 30; ! this.maxOpeningLengthInMinutes = 120; ! ! this.firstDateTime = new DateTime( 2006 , 1 , 1 ); ! this.lastDateTime = new DateTime( 2007 , 12, 31 ); this.intervalFrameInSeconds = 60; this.benchmark = new Benchmark( "MSFT" ); *************** *** 166,171 **** double maxCorrelationAllowed = 0.96; ! int numberOfBestTestingPositionsToBeReturned = 100; ! numberOfBestTestingPositionsToBeReturned = 100; bool balancedWeightsOnVolatilityBase = true; float minimumAbsoluteReturnValue = 0.000001f; --- 159,164 ---- double maxCorrelationAllowed = 0.96; ! int numberOfBestTestingPositionsToBeReturned = 50; ! numberOfBestTestingPositionsToBeReturned = 50; bool balancedWeightsOnVolatilityBase = true; float minimumAbsoluteReturnValue = 0.000001f; *************** *** 201,211 **** { //int inSampleDays = 90; ! int inSampleDays = 10; int numDaysBetweenEachOptimization = 5; int minNumOfEligiblesForValidOptimization = 20; ! double oversoldThreshold = 0.0075; ! double overboughtThreshold = 0.0075; double oversoldThresholdMAX = 0.02; double overboughtThresholdMAX = 0.02; IStrategyForBacktester strategyForBacktester --- 194,206 ---- { //int inSampleDays = 90; ! int inSampleDays = 150; int numDaysBetweenEachOptimization = 5; int minNumOfEligiblesForValidOptimization = 20; ! double oversoldThreshold = 0.0065; ! double overboughtThreshold = 0.0065; double oversoldThresholdMAX = 0.02; double overboughtThresholdMAX = 0.02; + double stopLoss = 0.02; + double takeProfit = 0.005; IStrategyForBacktester strategyForBacktester *************** *** 221,226 **** historicalMarketValueProviderForInSample, historicalMarketValueProviderForOutOfSample, ! timeForCheckingCrossingThreshold_begin, timeForCheckingCrossingThreshold_end, ! timeForEntry, timeForExit); return strategyForBacktester; } --- 216,221 ---- historicalMarketValueProviderForInSample, historicalMarketValueProviderForOutOfSample, ! inefficiencyLengthInMinutes , maxOpeningLengthInMinutes, this.getDailyTimes(), ! stopLoss , takeProfit ); return strategyForBacktester; } *************** *** 231,239 **** { List<Time> dailyTimes = new List<Time>(); ! dailyTimes.Add(this.timeForCheckingCrossingThreshold_begin); ! dailyTimes.Add(this.timeForCheckingCrossingThreshold_end); ! if(this.timeForEntry > this.timeForCheckingCrossingThreshold_end) ! dailyTimes.Add(this.timeForEntry); ! dailyTimes.Add(this.timeForExit); return dailyTimes; } --- 226,241 ---- { List<Time> dailyTimes = new List<Time>(); ! dailyTimes.Add( new Time("10:00:00") ); ! dailyTimes.Add( new Time("10:30:00") ); ! dailyTimes.Add( new Time("11:00:00") ); ! dailyTimes.Add( new Time("11:30:00") ); ! dailyTimes.Add( new Time("12:00:00") ); ! dailyTimes.Add( new Time("12:30:00") ); ! dailyTimes.Add( new Time("13:00:00") ); ! dailyTimes.Add( new Time("13:30:00") ); ! dailyTimes.Add(new Time("14:00:00") ); ! dailyTimes.Add(new Time("14:30:00") ); ! dailyTimes.Add(new Time("15:00:00") ); ! dailyTimes.Add(new Time("16:00:00") ); return dailyTimes; } *************** *** 264,268 **** // new InteractiveBrokerAccountProvider(fixedPercentageSlippage); double cashToStart = 25000; ! double maxRunningHours = 0.40; HistoricalMarketValueProvider quoteProviderForBackTester = this.historicalMarketValueProviderForOutOfSample; --- 266,270 ---- // new InteractiveBrokerAccountProvider(fixedPercentageSlippage); double cashToStart = 25000; ! double maxRunningHours = 5; HistoricalMarketValueProvider quoteProviderForBackTester = this.historicalMarketValueProviderForOutOfSample; *************** *** 278,282 **** return endOfDayStrategyBackTester; } ! protected override string getPathForTheMainFolderWhereScriptsResultsAreToBeSaved() { --- 280,289 ---- return endOfDayStrategyBackTester; } ! ! protected override string getCustomSmallTextForFolderName() ! { ! return "PVOIntraday"; ! } ! protected override string getPathForTheMainFolderWhereScriptsResultsAreToBeSaved() { *************** *** 285,294 **** return pathForTheMainFolderWhereScriptsResultsAreToBeSaved; } ! ! protected override string getCustomSmallTextForFolderName() ! { ! return "PVOIntraday"; ! } ! protected override string getFullPathFileNameForMain() { --- 292,296 ---- return pathForTheMainFolderWhereScriptsResultsAreToBeSaved; } ! protected override string getFullPathFileNameForMain() { |