Support Board
Date/Time: Sat, 23 Nov 2024 20:01:49 +0000
Post From: Set Volume-by-Price "Ticks per volume bar" by setting exact number of VbP bars on chart?
[2023-08-08 15:36:55] |
Tony - Posts: 516 |
Sorry funbun, I am not familiar with stocks. Back to your 2 screen shots: usm1.png is the most accurate profile, it is the reality, the problem is there are too many volume spikes that complicate the decision making process, set a higher tick number is basically to average out/blur the reality a little bit, and actually give us a "big picture" where volumes are distributed, shows in usm2.png. If you already tested the "40 horizontal bars" visual effect, here is the code that based on that idea, so you don't have to do anything, tick number is adjusted automatically, I haven't tested yet: #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 {6}; int Tick_Number {1}; static float TheHighestBuffer {0.0}; static float TheLowestBuffer {0.0}; int FirstIndex {sc.GetFirstIndexForDate(sc.ChartNumber, sc.BaseDataEndDateTime[sc.Index].GetDate())}; float TheHighest {sc.GetHighest(sc.High, sc.Index, sc.Index-FirstIndex)}; float TheLowest {sc.GetLowest(sc.Low, sc.Index, sc.Index-FirstIndex)}; if (!sc.Index) { TheHighestBuffer = 0.0; TheLowestBuffer = 0.0; } if (TheHighestBuffer != TheHighest || TheLowestBuffer != TheLowest) { Tick_Number = int ((TheHighest - TheLowest) / 40.0); sc.SetChartStudyInputInt(sc.ChartNumber, VbP_ID, 31, Tick_Number); sc.RecalculateChart(sc.ChartNumber); TheHighestBuffer = TheHighest; TheLowestBuffer = TheLowest; } } Unfortunately, I don't have the answer to your question, hope you will find the best option to address this. Date Time Of Last Edit: 2023-08-08 17:08:48
|