Support Board
Date/Time: Fri, 07 Feb 2025 00:16:15 +0000
Post From: Compile error 2098
[2020-05-06 16:20:48] |
ertrader - Posts: 681 |
You rock! This section is the last area I believe. These two lines fail: SCDateTime PriorPeriodStartDateTime = InitialStartDateTime - DaysBack * DAYS; SCDateTime PriorPeriodEndDateTime = PriorPeriodStartDateTime + 1 * DAYS - 1 * SECONDS; It seems SC documentation needs several updates on this topic. Without your help, frankly I would not have been able to update. Thank you! -------------------------- Here is the complete function ----------------------------- void GetIndexForStartofDayPeriodForDaysBack ( SCStudyInterfaceRef sc , const SCDateTime InitialStartDateTime , const int NumDaysToInclude , const bool ExcludeWeekends , const int MinimumRequiredTimePeriodInDayAsPercent , int& r_InitialBarIndex ) { int DaysBack = 0; for (int DaysCount = 1; DaysCount < NumDaysToInclude; ++DaysCount) { for (int Iterations = 10; Iterations > 0; --Iterations) { DaysBack++; SCDateTime PriorPeriodStartDateTime = InitialStartDateTime - DaysBack * DAYS; SCDateTime PriorPeriodEndDateTime = PriorPeriodStartDateTime + 1 * DAYS - 1 * SECONDS; const SCDateTime TradingDayDate = sc.GetTradingDayDate(PriorPeriodStartDateTime); r_InitialBarIndex = sc.GetNearestMatchForSCDateTime(sc.ChartNumber, PriorPeriodStartDateTime); if (ExcludeWeekends && TradingDayDate.IsWeekend()) continue; const int PriorPeriodLastIndex = sc.GetNearestMatchForSCDateTime(sc.ChartNumber, PriorPeriodEndDateTime); const double ActualTimeSpan = sc.CalculateTimeSpanAcrossChartBars ( r_InitialBarIndex , PriorPeriodLastIndex ); //If there is a sufficient amount of data in this time period if (ActualTimeSpan > 1*DAYS * (MinimumRequiredTimePeriodInDayAsPercent * 0.01)) break; } } } Date Time Of Last Edit: 2020-05-06 16:25:44
|