Login Page - Create Account

Support Board


Date/Time: Wed, 12 Mar 2025 05:00:17 +0000



Write Bar Study with Numbers Bars (Bar Time Duration always zero)

View Count: 308

[2024-12-15 00:59:47]
DHTrading - Posts: 17
Gentlemen,

I might be misunderstanding this but I can see the bar time format 0:00:17 on the numbers bar study on the chart for example. But when I use the write bar and indicator data study that column always seems to be 0. If I add on and use the Bar Time Duration study I can see the fraction, do the math and it's pretty accurate for the most part taking into account machine delays when comparing those to the time columns. Seems like I'm doing it wrong.

Thoughts?
[2024-12-16 15:14:49]
John - SC Support - Posts: 38598
Please give us an example of what you are seeing from your file.
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2024-12-17 00:33:54]
DHTrading - Posts: 17
Apologies for the mess. I've tried range bars and 1m bars. Duration Study is correct.

Date, Time, Open, High, Low, Last, Volume, # of Trades, OHLC Avg, HLC Avg, HL Avg, Bid Volume, Ask Volume, AskVBidVDiff, AskVBidVTot, AskBidBarDiff, PosDeltaSum, NegDeltaSum, AskVolTot, BidVolTot, MaxAskVMinusBidV, MinAskVMinusBidV, CumSumAskBidVolDiffDay, AskVBidVDiffPct, NumOfTrades, VolumeTot, VolBarDiffTot, AvgVolPerTrade, AvgVolPerPrice, AskVolPct, BidVolPct, CumSumAskBidVolDiff, POCVol, CumDeltaVolHigh, CumDeltaVolLow, AskBidDiffMinToMax, AskBidTicksDiff, CumSumAskBidTicksDiff, CumDeltaTradesHigh, CumDeltaTradesLow, MaxAskBidVollDiffToCloseAskBidVolDiff, MinAskBidVollDiffToCloseAskBidVolDiff, BarTime, VolumePerSecond, CumDeltaMinusDelta, CumVolumeDay, POCValue, DiagonalPosDeltaSun, DiagNegDeltaSum, LowBidVolPct, HighAskVolPct, CumDeltaUpDownTickVolume, TotalUpTickVolume, TotalDnTickVolume, BidVolumePerSecond, AskVolumePerSecond, R1, R2, S1, S2, R3, S3, PP, PP High, PP Low, Duration, CD Open, CD High, CD Low, CD Close
2024-12-15, 17:00:00.000000, 71.44, 71.44, 71.06, 71.17, 242, 198, 71.28, 71.22, 71.25, 117, 125, 8, 242, 8, 58, 50, 125, 117, 13, -26, 8, 0, 198, 242, 242, 1, 10, 1, 0, 8, 24, 13, -26, 34, 28, 28, 33, -14, 5, -34, 0, 4, 0, 242, 71, 70, 62, 1, 1, -14, 114, 128, 2, 2, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.0006944444612599909, 0, 13, -26, 8
2024-12-15, 17:01:00.000000, 71.18, 71.19, 71.11, 71.13, 71, 56, 71.15, 71.14, 71.15, 40, 31, -9, 71, -17, 4, 13, 31, 40, 3, -18, -1, -0, 56, 71, -171, 1, 8, 0, 1, -1, 14, 11, -10, -12, -2, 26, 35, 19, 12, -9, 0, 1, 8, 313, 71, 5, 14, 1, 3, -17, 34, 37, 1, 1, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.0006944444612599909, 8, 11, -10, -1
2024-12-15, 17:02:00.000000, 71.15, 71.15, 71.06, 71.09, 62, 53, 71.11, 71.10, 71.10, 37, 25, -12, 62, -3, 6, 18, 25, 37, 3, -16, -13, -0, 53, 62, -9, 1, 7, 0, 1, -13, 15, 2, -17, -15, -5, 21, 29, 15, 15, -4, 0, 1, -1, 375, 71, 5, 17, 7, 0, -21, 29, 33, 1, 0, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.0006944444612599909, -1, 2, -17, -13
[2024-12-17 15:12:18]
John - SC Support - Posts: 38598
The time of the bars is fine. We assume this is from your 1 minute chart, as the times are showing 1 minute intervals.

What exactly are you saying is wrong with this?
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2024-12-23 16:15:15]
DHTrading - Posts: 17
Hey John,

Apologies for my absence. I've been out of town. Here's a sample of the data in a more concise format.

The BarTime column is from numbers bars calculated. The duration is from Bar Time Duration study

(test) C:\Trading\MarketData\CL>python prettyprint.py CL_1TickFP_10Days.csv BarTime
Date | Time | BarTime
2024-12-15 | 17:00:00.000000 | 0
2024-12-15 | 17:00:00.002000 | 0
2024-12-15 | 17:00:00.002001 | 0
2024-12-15 | 17:00:00.002002 | 0

(test) C:\Trading\MarketData\CL>python prettyprint.py CL_1TickFP_10Days.csv Duration
Date | Time | Duration
2024-12-15 | 17:00:00.000000 | 0.000000023148148287077674
2024-12-15 | 17:00:00.002000 | 1.1574074164355519e-11
2024-12-15 | 17:00:00.002001 | 1.1574074164355519e-11
2024-12-15 | 17:00:00.002002 | 0.000004849513970839325

It's not a big deal. I can hide the BarTime and add the Duration study to include that column. I just wasn't sure if it was a bug or I'm doing it wrong.

Probably the latter.
Date Time Of Last Edit: 2024-12-23 16:17:02
[2024-12-23 16:59:57]
John - SC Support - Posts: 38598
We are not understanding where this data is coming from. If this is a study that you have created, then there is something wrong with your study.
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2024-12-23 17:33:04]
DHTrading - Posts: 17
Both studies are in Sierra Chart.

Numbers Bars Calculated Values and Bar Time Duration.

I'm writing the data out to a csv with the write bar and study data to file

I wrote a python script to show the column differences from the csv so it wasn't displaying a mess like my previous messages.

BarTime shows "0"
Duration shows the fraction

I expected to see the fraction in the "BarTime" output from Numbers Bars Calculated Values.
Date Time Of Last Edit: 2024-12-23 17:38:49
imageScreenshot 2024-12-23 112920.png / V - Attached On 2024-12-23 17:29:34 UTC - Size: 12.09 KB - 42 views
[2024-12-23 19:48:44]
John - SC Support - Posts: 38598
We can only help you as far as the "Write Bar and Study data to File" study goes. In that output that you supplied in post #3, the bar date and time is correct. Therefore, if the output from your Python script is not correct, then there is something wrong with your script.
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2024-12-24 12:25:29]
DHTrading - Posts: 17
I'm not sure why you think it's my problem. I didn't write the studies. I wish I could code like you guys.

Numbers Bar Calculated Values Study is a Sierra Chart provided study and it has a SubGraph called "Bar Duration" which is a separate feature to Date and Time columns.
In the csv, it should show the duration of the bar such as a range bar as a floating point decimal so that it can be calculated externally. When that subgraph is enabled and written to csv it's always zero. There are other values like day and week range that are consistently 0s in the CSV. It's not just the BarTime-Bar Duration deal.

If I add the separate but also supplied Sierra Chart study called Bar Time Duration as an secondary study to numbers bars calculated and write that out to csv it naturally shows the CORRECT value.

I'm not sure how else to explain it so here are the steps to reproduce


Steps To Reproduce
==================
Load Numbers Bars Calculated Values on any numbers bars chart like ES, CL, NQ, GC, RTY, YM

Enable all subgraphs to visible.

Load Write Bar and Study Data to File study and give it a file name to export the bar data.

Compare the output of the csv to the output on the screen.

Result
======
The screen values show consistently and accurately.
Some of the values are consistently written as 0s in the csv columns.
Date Time Of Last Edit: 2024-12-24 12:58:04
imageBarTime.JPG / V - Attached On 2024-12-24 12:19:57 UTC - Size: 223.82 KB - 49 views
imageBarTime Output.JPG / V - Attached On 2024-12-24 12:20:02 UTC - Size: 172.23 KB - 45 views
[2024-12-26 15:22:22]
John - SC Support - Posts: 38598
We did not realize you were referring to the "Bar Duration" subgraph, we thought it was about the time of the bar.

The Numbers Bars Calculated Values internally sets the format for values that are displayed, since you can have different types of values, which is not normally supported in a study. As such, the default "Value Format" that is set for the study is "1", as most items are volumes. The reason you are seeing zeros is due to this setting for the "Value Format". Change the "Value Format" for the Numbers Bars Calculated Values to be 0.00000001 and then you will be able to get more decimal places for the subgraph being outputted. Although this also means you will see additional decimal places for any other subgraphs from that study.
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2024-12-26 20:03:21]
Sierra_Chart Engineering - Posts: 18750
Yes this is a problem with the Value Format.
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, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2024-12-27 02:15:27]
DHTrading - Posts: 17
It makes sense now. Ingenious and logical.

Thank you gentlemen for pointing out the ID10T and PEBKAC errors.

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account