Login Page - Create Account

Support Board


Date/Time: Thu, 23 Jan 2025 05:02:36 +0000



VWAP Indicator Calculation Start Time

View Count: 2584

[2018-11-16 01:31:05]
User41727 - Posts: 124
When using the (non-rolling) VWAP indicator with period type "days" and period length 1, the documentation specifies that

the calculations will begin at the start of each trading day according to the Session Times and end at the end of the trading day.

What I expected this to mean is that calculations would start at the "Start Time" specified under "Sessions Times". This is not the case when "Use Evening Session" is active, in which case the "Evening Start" is used for VWAP calculation. What this means is that you cannot have a VWAP just for the regular trading hours while using a chart with extended hours (Unless one manually sets the VWAP's Start Date-Time each day).

Is this the intended behaviour? Because it is not very useful as most users will want the RTH VWAP.
[2018-11-16 16:14:12]
John - SC Support - Posts: 37420
Yes that is the intended behavior for that study. In order to do what you want you would need to use the Volume by Price study and set the following Inputs:
- Draw Mode: POC, VAH, VAL, VWAP Lines
- Volume Graph Period Type: Trading Day Start Time to End - Reset at Day Session

The other Inputs you can set as you need.

You will find the documentation for the Volume by Profile Inputs here:
https://www.sierrachart.com/index.php?page=doc/StudiesReference.php&ID=141&Name=Volume_by_Price#Settings

If you do not want to have the POC, VAH, and VAL lines displayed along with the VWAP, then you can turn those off in the Subgraphs tab. The documentation for how to do this is here:
Chart Studies: Subgraphs Tab >> Draw Style
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[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

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account