Support Board
Date/Time: Sat, 23 Nov 2024 07:37:57 +0000
Post From: Bid Ask Volume Ratio
[2013-06-19 18:28:24] |
Sierra Chart Engineering - Posts: 104368 |
In Sierra Chart, all studies are continuously updated unless they are programmed to ignore the last bar in the chart. This is possible. Here is the code for this study which has this code added: SCSFExport scsf_BidAskVolumeRatio(SCStudyInterfaceRef sc)
{ SCSubgraphRef VolRatioAvg = sc.Subgraph[0]; SCSubgraphRef ZeroLine = sc.Subgraph[1]; SCFloatArrayRef ExtraArrayRatio = sc.Subgraph[0].Arrays[0]; SCInputRef InMALength = sc.Input[0]; SCInputRef InMAType = sc.Input[1]; if (sc.SetDefaults) { // Set the configuration and defaults sc.GraphName = "Bid Ask Volume Ratio"; sc.StudyDescription = "Bid Ask Volume Ratio"; sc.AutoLoop = 1; //During development set this flag to 1, so the DLL can be modified. When development is completed, set it to 0 to improve performance. sc.FreeDLL = 0; VolRatioAvg.Name = "Vol Ratio Avg"; VolRatioAvg.DrawStyle = DRAWSTYLE_LINE; VolRatioAvg.PrimaryColor = RGB(0,255,0); VolRatioAvg.DrawZeros = false; ZeroLine.Name = "Zero Line"; ZeroLine.DrawStyle = DRAWSTYLE_LINE; ZeroLine.PrimaryColor = RGB(255,0,255); ZeroLine.DrawZeros = true; InMALength.Name = "Length"; InMALength.SetInt(14); InMALength.SetIntLimits(1,MAX_STUDY_LENGTH); InMAType.Name= "Moving Average Type"; InMAType.SetMovAvgType(MOVAVGTYPE_EXPONENTIAL); return; } if(sc.GetBarHasClosedStatus() == BHCS_BAR_HAS_NOT_CLOSED) return; // Do data processing float UpVol = sc.AskVolume[sc.Index]; float DownVol = sc.BidVolume[sc.Index]; float TotalVol = UpVol + DownVol; if (TotalVol > 0) ExtraArrayRatio[sc.Index] = 100.0f * (UpVol - DownVol) / TotalVol; else ExtraArrayRatio[sc.Index] = 0.0f; sc.MovingAverage(ExtraArrayRatio, VolRatioAvg, InMAType.GetMovAvgType(), InMALength.GetInt()); } To compile this study into a DLL file which can then be used, refer to this page: https://www.sierrachart.com/index.php?l=doc/doc_BuildCustomStudiesDLL.html Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service: Sierra Chart Teton Futures Order Routing |