Login Page - Create Account

Support Board


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



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

[2023-08-05 21:20:34]
Tony - Posts: 502
@funbun
just in case, if you haven't figured it out yet, I tested the code below,
it works very well on my Sierra window, the study increase/decrease
VbP's tick number by pressing "+" or "-" on number key pad.

(you will need to change the VbP study ID accordingly, depends on
how you load your VbP study, also the number goes from 1 cent to
50 cents, you can change the high end of the range too)

Thanks for sharing the tip of making stock profile smoother!



#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 {3};
static 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);
sc.RecalculateChart(sc.ChartNumber);
}

if (sc.CharacterEventCode==45) {
Tick_Number = max(1, Tick_Number-1);
sc.SetChartStudyInputInt(sc.ChartNumber, VbP_ID, 31, Tick_Number);
sc.RecalculateChart(sc.ChartNumber);
}

}

Date Time Of Last Edit: 2023-08-05 21:27:10