Login Page - Create Account

Support Board


Date/Time: Mon, 21 Apr 2025 14:47:43 +0000



[Programming Help] - DRAWING_VOLUME_PROFILE Example Study

View Count: 94

[2025-04-17 03:41:03]
User200641 - Posts: 6
I am attempting to draw a volume profile starting when an even occurs in my custom study. There are debug statements in my code that show this block is getting run when the event triggers. Config 3 is the VP config I set up and want to use for this study (followed the steps here: Volume By Price Study: Step by Step Instructions to Configure the Draw Volume Profile Tool).

Will there be an example study for using DRAW_VOLUME_PROFILE added in the future? My search of the ACS_Source directory didn't find anything.


if(event)
{
s_UseTool Tool;
int& r_LineNumber= sc.GetPersistentInt(1);
if (r_LineNumber!= 0)
Tool.LineNumber = r_LineNumber;

Tool.ChartNumber = sc.ChartNumber;
Tool.DrawingType = DRAWING_VOLUME_PROFILE;

Tool.BeginIndex = sc.Index;

// I also tried with BeginDateTime
// Tool.BeginDateTime = sc.BaseDateTimeIn[sc.Index];

Tool.Region = 0;
Tool.UseToolConfigNum = 3;

Tool.AddMethod = UTAM_ADD_OR_ADJUST;

sc.UseTool(Tool);
r_LineNumber = Tool.LineNumber;

}

[2025-04-19 02:46:38]
User200641 - Posts: 6
To anyone reading this in the future:

I ended up using a VbP study and then updating the start date/start time from my custom study. This also allows easier modification than having to update a config, etc.

Note that the inputs for date/time are separate for the VbP study (unlike the VWAP study). I had trouble just passing the full SCDateTime (as a double). Using something like this worked:



// This is the datetime you want VbP to start at
SCDateTime newDateTime {generateEventDateTime()};

// This will be passed to the "Start Date" VbP input
int date {newDateTime.GetDate()};

// This will be passed to the "Start Time" VbP input
SCDateTime timeOnly {newDateTime.GetTimeAsSCDateTime()};

// Setting the VbP study Start Date input
sc.SetChartStudyInputInt(sc.ChartNumber, Input_VbPStudyID.GetStudyID(), 36, date);
// Setting the VbP study Start Time input
sc.SetChartStudyInputFloat(sc.ChartNumber, Input_VbPStudyID.GetStudyID(), 38, time_only.GetAsDouble());


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

Login

Login Page - Create Account