Support Board
Date/Time: Tue, 04 Mar 2025 19:20:19 +0000
[Programming Help] - Formula for another chart time
View Count: 571
[2021-12-21 08:03:17] |
User278398 - Posts: 291 |
hello all... * in 1 min chart i got values of the next formula BV/AV (for example, i got at 9:30 at close 1.96 ... this number changing up and down over this 1 min ) i want to see this values over time in 1 second chart (for example 1.7,1.78,1.9....,1.96 close) some one know how can i do that ? regards |
[2021-12-21 08:07:35] |
Bet_More_Tim - Posts: 21 |
open a 1s chart, open a spreadsheet function study, make it "=BV/AV" or whatever you want... and then add another study, summation of study subgraph periodic, set to your spreadsheet function study, and set it to 60 bars to represent a rolling 1m BV/AV thats gonna be method 1. method 2 is write a custom acsil study that does it |
[2021-12-21 08:32:07] |
Bet_More_Tim - Posts: 21 |
open notepad, paste this in it, and save it as whatever you want with a .cpp extention open sierra, analysis drop down menu, build study, and choose the .cpp file and then choose remote build #include "sierrachart.h"
SCDLLName("Rolling BV/AV") SCSFExport scsf_RollingBV_AV(SCStudyInterfaceRef sc) { int i = 0; SCSubgraphRef BV_AV_sum = sc.Subgraph[i]; SCSubgraphRef BVAV = sc.Subgraph[++i]; SCInputRef Lag = sc.Input[0]; if (sc.SetDefaults) { sc.GraphName = "Rolling BV/AV"; sc.StudyDescription = "Rolling Bid Vol/Ask Vol Study"; sc.AutoLoop = 1; sc.GraphRegion = 1; BV_AV_sum.Name = "BV/AV"; Lag.Name = "summation lag"; Lag.SetInt(60); return; } BVAV[sc.Index] = (sc.BidVolume[sc.Index])/ (sc.AskVolume[sc.Index]+1); sc.Summation(BVAV, BV_AV_sum, Lag.GetInt()); } this is assuming you want exactly what you said. Bid vol over Ask Vol (BV/AV) you can change the BVAV[sc.Index] = (sc.BidVolume[sc.Index])/ (sc.AskVolume[sc.Index]+1);[sc.Index];
line to any other calculation of bid and ask vol that you'd want. also you can change the lag to whatever you want, whether its 1m or 2m or however many bars btw I add in +1 because if you try to divide by 0, you're gonna have a bad time. Edit: I should clarify, doing this will create a custom study, that you add thru the custom study menu button on the add studies F6 window, and also when I mentioned changing the lag, that will be from the study settings menu. Date Time Of Last Edit: 2021-12-21 09:03:09
|
![]() |
[2021-12-21 11:00:09] |
User907968 - Posts: 833 |
In case #2 and #3 are not what you are looking for, see attached chartbook for alternative.
|
![]() |
[2021-12-23 13:42:23] |
User278398 - Posts: 291 |
all is working great! thank u all very much |
To post a message in this thread, you need to log in with your Sierra Chart account: