Support Board
Date/Time: Wed, 15 Jan 2025 16:21:36 +0000
Post From: "Volume Weighted Average Price - Rolling" resets on Sundays.
[2017-07-29 19:58:57] |
Sporken - Posts: 82 |
Increasing "Minimum Required Time Period as Percent" was ineffective because I am setting "Time Period Length" to 1. This means GetIndexForStartofDayPeriodForDaysBack is called with NumDaysToInclude=1 so the function returns without iterating. MinimumRequiredTimePeriodInDayAsPercent is unreferenced. This is the code that causes the issue. In scsf_RollingVolumeWeightedAveragePrice in studies3.cpp:758 else if (PeriodType == 1) // Days - 24 hour periods { SCDateTime CurrentPeriodStartDateTime = sc.BaseDateTimeIn[Index] - 1 * DAYS + 1 * SECONDS; r_FirstIndexIncluded = sc.GetContainingIndexForSCDateTime(sc.ChartNumber, CurrentPeriodStartDateTime); I propose the following amendment for your consideration else if (PeriodType == 1) // Days - 24 hour periods { SCDateTime CurrentPeriodStartDateTime = sc.BaseDateTimeIn[Index] - 1 * DAYS + 1 * SECONDS; if (ExcludeWeekendInDateCalc.GetYesNo() && ((sc.BaseDateTimeIn[Index].GetDayOfWeek() == SUNDAY) || (sc.BaseDateTimeIn[Index].GetDayOfWeek() == MONDAY))) { CurrentPeriodStartDateTime = sc.BaseDateTimeIn[Index] - (3 * DAYS) + (1 * SECONDS); } r_FirstIndexIncluded = sc.GetContainingIndexForSCDateTime(sc.ChartNumber, CurrentPeriodStartDateTime); This appears to correct the discontinuity on my 5min and hourly charts on both futures and forex. I also tested increasing "Time Period Length" and it appeared to be ok. This behaviour/code is also seen on "Moving Average - Rolling High Accuracy" A better fix might be to amend GetIndexForStartofDayPeriodForDaysBack and eliminate the sc.BaseDateTimeIn[Index] - 1 * DAYS + 1 * SECONDS calculation entirely. I'm not very familiar with the code so there may be other ways to approach this. Date Time Of Last Edit: 2017-07-29 20:04:49
|