Support Board
Date/Time: Fri, 30 Jan 2026 17:30:33 +0000
export volume at price data to txt file
View Count: 15
| [2026-01-30 15:39:07] |
| userlk0m - Posts: 3 |
|
When I export the price data to text file (including studies), volume at price values from the Numbers or VbP studies do not export. How can I export them? |
| [2026-01-30 16:38:23] |
| John - SC Support - Posts: 44317 |
|
You can not export the Numbers Bars data. For VbP data, refer to the following: Spreadsheet Study Inputs: Output Volume at Price Data For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing |
| [2026-01-30 16:41:11] |
| userlk0m - Posts: 3 |
|
I ended up using code for it, I'll post it here for anyone else trying to do the same: #include "sierrachart.h"
#include <fstream> #include <cstdio> // snprintf SCDLLName("Per Bar VAP Exporter") SCSFExport scsf_VAP_Export(SCStudyInterfaceRef sc) { if (sc.SetDefaults) { sc.GraphName = "Export Per-Bar VAP (Price,Volume Pairs)"; sc.AutoLoop = 0; sc.UpdateAlways = 0; return; } // Overwrite each run. Change to std::ios::app to append. std::ofstream file("vap_export.txt", std::ios::trunc); if (!file.is_open()) return; file << "DateTime,BarIndex,VAP\n"; for (int bar = sc.UpdateStartIndex; bar < sc.ArraySize; ++bar) { const int count = sc.VolumeAtPriceForBars->GetSizeAtBarIndex(bar); if (count <= 0) continue; // DateTime string: YYYY-MM-DD HH:MM:SS int Y=0, M=0, D=0, h=0, m=0, s=0; sc.BaseDateTimeIn[bar].GetDateTimeYMDHMS(Y, M, D, h, m, s); char dt[32]; std::snprintf(dt, sizeof(dt), "%04d-%02d-%02d %02d:%02d:%02d", Y, M, D, h, m, s); // Start row: quote the bracket field so commas inside don't break CSV file << dt << "," << bar << ",\"[ "; for (int i = 0; i < count; ++i) { s_VolumeAtPriceV2* p = nullptr; if (!sc.VolumeAtPriceForBars->GetVAPElementAtIndex((unsigned int)bar, i, &p) || p == nullptr) continue; const double price = (double)p->PriceInTicks * sc.TickSize; const int vol = p->Volume; file << "(" << price << "," << vol << ")"; if (i != count - 1) file << ", "; } file << " ]\"\n"; } file.close(); } Date Time Of Last Edit: 2026-01-30 16:41:54
|
To post a message in this thread, you need to log in with your Sierra Chart account:
