Login Page - Create Account

Support Board


Date/Time: Thu, 23 Jan 2025 09:45:42 +0000



Post From: VWAP Indicator Calculation Start Time

[2018-11-16 19:39:18]
User41727 - Posts: 124
That seems like overkill, especially since I would then not be able to use the VbP study for the ETH without adding a second instance of this costly study.

The much easier solution is to add a flag to VWAP that allows the user to chose a reset at the start of the day session. Here, I even made you a patch.

--- studies3.cpp  2018-11-16 20:32:54.851673000 +0100
+++ studies3_new.cpp  2018-11-16 20:31:42.364951000 +0100
@@ -570,10 +570,11 @@
SCInputRef InputData = sc.Input[0];
  SCInputRef BandCalculationMethod = sc.Input[1];
SCInputRef TimePeriodType = sc.Input[3];  
-  SCInputRef TimePeriodLength = sc.Input[4];  
-  SCInputRef Version = sc.Input[5];  
-  SCInputRef DistanceMultiplier_V3 = sc.Input[6];
-  SCInputRef IgnoreTimePeriodTypeAndLength = sc.Input[7];
+  SCInputRef TimePeriodLength = sc.Input[4];
+  SCInputRef NewPeriodDaySessionStart = sc.Input[5];
+  SCInputRef Version = sc.Input[6];  
+  SCInputRef DistanceMultiplier_V3 = sc.Input[7];
+  SCInputRef IgnoreTimePeriodTypeAndLength = sc.Input[8];
  SCInputRef BaseOnUnderlyingData = sc.Input[9];
  SCInputRef UseFixedOffset = sc.Input[10];
  SCInputRef StartDateTime     = sc.Input[11];
@@ -663,6 +664,10 @@
    TimePeriodLength.SetInt(1);
    TimePeriodLength.DisplayOrder = DisplayOrder++;

+    NewPeriodDaySessionStart.Name = "New Period at Day Session Start when Using Evening Session";
+    NewPeriodDaySessionStart.SetYesNo(false);
+    NewPeriodDaySessionStart.DisplayOrder = DisplayOrder++;
+
    StartDateTime.Name = "Start Date-Time";
    StartDateTime.SetDateTime(0.0);
    StartDateTime.DisplayOrder = DisplayOrder++;
@@ -787,8 +792,8 @@

  if(!IgnoreTimePeriodTypeAndLength.GetYesNo())
  {
-    CurrentPeriodStartDateTime = sc.GetStartOfPeriodForDateTime(sc.BaseDateTimeIn[sc.Index], TimePeriodType.GetTimePeriodType(), TimePeriodLength.GetInt(), 0);
-    PriorCurrentPeriodStartDateTime = sc.GetStartOfPeriodForDateTime(sc.BaseDateTimeIn[sc.Index - 1], TimePeriodType.GetTimePeriodType(), TimePeriodLength.GetInt(), 0);
+    CurrentPeriodStartDateTime = sc.GetStartOfPeriodForDateTime(sc.BaseDateTimeIn[sc.Index], TimePeriodType.GetTimePeriodType(), TimePeriodLength.GetInt(), 0, NewPeriodDaySessionStart.GetYesNo());
+    PriorCurrentPeriodStartDateTime = sc.GetStartOfPeriodForDateTime(sc.BaseDateTimeIn[sc.Index - 1], TimePeriodType.GetTimePeriodType(), TimePeriodLength.GetInt(), 0, NewPeriodDaySessionStart.GetYesNo());
  }

  bool IsStartOfNewPeriod = false;

Date Time Of Last Edit: 2018-11-16 19:44:49