Login Page - Create Account

Support Board


Date/Time: Sun, 11 May 2025 23:03:56 +0000



Referencing Previous Bar

View Count: 2551

[2016-05-11 15:12:24]
JamesP - Posts: 89
Hello,
For an auto trading spreadsheet formula I'm trying to reference the previous bar's bid ask ratio number and want it to be > 0. In trying to follow the SC documentation I have ID8.SG1[-1]@4>0. This formula doesn't work, just wondering what's wrong here? Do I need to reference row 4? Thanks.
[2016-05-11 15:29:13]
Sawtooth - Posts: 4214
Simple Alert reference of previous bar: ID8.SG1[-1]
Spreadsheet reference of previous bar: ID8.SG1@4
[2016-05-11 16:19:18]
JamesP - Posts: 89
Thank you Tom, helpful as always. If you and/or SC support don't mind a follow up question. I have the bid/ask ratio from a higher range bar chart added to the original spreadsheet study chart as a study/price overlay and for some reason a bunch of rows all display the current bars row 3 value, basically instead of just row 3 having the current value and row 4 the previous value, row 3 to 15 will be the same value and row 16 to 23 will be the same (supposed to be row 4) value) e.t.c.
[2016-05-11 16:32:37]
Sawtooth - Posts: 4214
Each row is a chart bar so a bar of a higher timeframe will last longer than a bar of a lower timeframe, so this is expected.
IOW, row 3 of a lower timeframe will be a portion of the higher timeframe's row 3.
[2016-05-11 16:43:08]
JamesP - Posts: 89
Ok thanks, how would I reference the previous bar because ID8.SG1@4 wouldn't work in this case right?
[2016-05-11 16:55:23]
Sierra Chart Engineering - Posts: 104368
The answer given in the prior post is correct.
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
[2016-05-11 18:00:09]
Sawtooth - Posts: 4214
The previous bar of the higher timeframe is back at row 16 on the lower timeframe.
I'm not sure what you are doing, but it will likely involve some kind of workaround or a more complex formula.
You could use a +1 displacement of the BA ratio study on the higher timeframe, which would move the previous bar to the current bar position.

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

Login

Login Page - Create Account