Login Page - Create Account

Support Board


Date/Time: Sun, 08 Sep 2024 00:42:41 +0000



Post From: Set Volume-by-Price "Ticks per volume bar" by setting exact number of VbP bars on chart?

[2023-08-04 19:22:48]
Tony - Posts: 502
1,
automatically adjusting the VbP according to changes in volatility
That is incorrect, VbP's Ticks Per Volume Bar should always set as 1 tick, regardless of volatility.

2,
Is there a way to automatically set the "ticks per volume bar" just by giving a number of VbP bars I want to see on the chart
no, because each session's range is different.

3,
Ideally, there could also be +/- buttons on the Control Bar to adjust that number (more or less VbP bar density)
yes, you can set "Tick Per Volume" by a ACSIL fuction called "sc.SetChartStudyInputInt()"

Sample code:

#include "sierrachart.h"
SCDLLName("VbP_Tick")

SCSFExport scsf_VbP_Tick(SCStudyInterfaceRef sc)
{

  if (sc.SetDefaults)
  {
    sc.GraphName = "Change VbP Tick Number";
    sc.GraphRegion = 0;
    sc.UpdateAlways = 1;
    sc.ReceiveCharacterEvents = 1;
    sc.AutoLoop = 1;
    
    return;
  }
  
  int VbP_ID {1};
  int Tick_Number {1};

  // change Tick_Number based on keyboard input, + to increase, - to decrease
  if (sc.CharacterEventCode==43) {
    Tick_Number = min(50, Tick_Number+1);
    sc.SetChartStudyInputInt(sc.ChartNumber, VbP_ID, 31, Tick_Number);
  }
  if (sc.CharacterEventCode==45) {
    Tick_Number = max(1, Tick_Number-1);
    sc.SetChartStudyInputInt(sc.ChartNumber, VbP_ID, 31, Tick_Number);
  }
  
}


Date Time Of Last Edit: 2023-08-05 10:42:36