Login Page - Create Account

Support Board


Date/Time: Tue, 04 Mar 2025 19:20:29 +0000



Post From: Formula for another chart time

[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
imageScreenshot 2021-12-21 032957.jpg / V - Attached On 2021-12-21 08:30:29 UTC - Size: 324.79 KB - 137 views