# Support Board

Date/Time: Fri, 19 Jul 2024 19:23:00 +0000

## [User Discussion] - average AVAP/BVAP

### View Count: 226

 [2024-06-05 04:54:12] #1 jivetrader - Posts: 399 Consider a typical NumBars bid x ask chart display. How can we calculate the average, and stdev, of bid volume at price over the last n price ticks? In other words, the average of the last n number of bid volumes shown in the NumBars? I have tried: AVERAGE(BVAP(C,[0:-1000]) Thanks in advance
 [2024-06-05 14:34:12] #2 John - SC Support - Posts: 33163 The VAP() functions do not support ranges. Therefore the only way to do what you are wanting would be to call out each individual bar that you want to include in the calculation. For instance, to get the AVERAGE of the last 3 bars you would use the following formula in a Spreadsheet Formula: =AVERAGE(BVAP(C, 0), BVAP(C, -1), BVAP(C, -2)) The better option would be to create a custom study. Refer to the following: ACSIL Programming Concepts: Accessing Volume at Price Data Per Bar List of Third Party Sierra Chart Study and System Programmers For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing
 [2024-06-07 06:34:13] #3 jivetrader - Posts: 399 Thanks. Now, using Color Bar Based on Alert Cond, what Output When True settings can highlight the HIGH of a bar minus TICKSIZE*1, in other words, the 2nd highest price level of a bar?
 [2024-06-07 15:15:19] #4 John - SC Support - Posts: 33163 You need to start with a study that will give you the High minus the Tick Size. The easiest way to do this is to use the "Spreadsheet Formula" study and enter the following formula: =H - TICKSIZE Then on the "Color Bar Based on Alert Condition" set the Input for "Output When Condition True" to be "Study Subgraph Reference" and in the Input for "Study Subgraph Reference Value When True" enter the information for the Spreadsheet Formula. You can hide the Spreadsheet Formula. There are a number of options to use to draw something to highlight that price. In particular note the Draw Styles of "Left/Ride Side Tick Size Rectangle Outline". But there are other things you can do as well. You will need to go through the available Draw Styles and see what works best for you. Refer to the following: Chart Studies: Subgraphs Tab >> Draw Style The documentation for the rest of the referenced items are here: Color Bar Based on Alert Condition Spreadsheet Formula For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing
 [2024-06-07 17:53:58] #5 jivetrader - Posts: 399 I’m sorry but this is really inconvenient and requiring many studies to accomplish even before this procedure you describe, which will need to be done for every price point in a bar. I am going through many hoops here piling up many spreadsheet formula studies just to create the averages, then compare bis/ask to them. There must be a better way. All i am trying to do is compare the current bid value to average bid value over the last several bars. To me this points to a lack of functionality in Sierra. I do not code beyond study formulas, and ACSIL should not be required to do this IMO. Can we rethink this please, I don’t think my request in unusual. Perhaps it could be built into Numbers Bars Calc Values 2 study or something.
 [2024-06-07 18:49:28] #6 John - SC Support - Posts: 33163 The "easy" solution is a Custom Study using ACSIL. Otherwise, the Bid and Ask data is not readily available except through the Alert functions noted previously. Therefore, what we have been giving you is the way to do this without programming it. For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing
 [2024-06-07 22:30:10] #7 jivetrader - Posts: 399 Ok then, understood. How about recommending an AI tool that helps with ACSIL? :)