Support Board
Date/Time: Fri, 18 Apr 2025 04:04:18 +0000
HOW TO REFERENCE A PREVIOUS SUBGRAPH?
View Count: 310
[2025-03-30 18:22:33] |
Trade with ICE - Posts: 25 |
hi im trying to reference the VAH/VAL subgraphs and ignore the current ones. i set my the vol by price to reference 1 day lookback but keep referencing the new one. https://postimg.cc/bss2Hfqp i cant use the VOLUME VALUE AREA LINES STUDY because of the time period of my profiles in the chart (They have different time spans) https://postimg.cc/jCPn54q4 |
![]() ![]() |
[2025-03-30 20:23:28] |
Sierra_Chart Engineering - Posts: 19257 |
We are not fully understanding this. Is there another study which is referencing the Subgraphs?
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 |
[2025-03-30 22:57:49] |
Trade with ICE - Posts: 25 |
im trying to get the value of the PREVIOUS VAH/VAL. I have a custom start and end times in my volume profile, so using the default Volume Value Area Lines study is not useful because the profiles don't have the same time length. I tried using the STUDY SUBGRAPHS REFERENCE, but still, the value of the subgraph changes once the new profile starts. i hope im making sense |
[2025-03-30 23:46:07] |
Trade with ICE - Posts: 25 |
to make it more simple im trying to get the value of the previous value area, but the subgraph values change when a new volume profile starts.
|
[2025-03-31 17:48:00] |
John - SC Support - Posts: 39353 |
Assuming that you are using multiple profiles in a single Volume by Price study, the discontinuity in the data is what you need to find the previous value. To do this for the Value Area High, add the Spreadsheet Study to the chart and in cell K3 enter the following formula: =IF(ID1.SG3@3 <> ID1.SG3@4, ID1.SG3@4, 0) Then enter the following in cell L3: =MOSTRECENTNONZEROVALUE($K$3:$K$1000) Where ID1 is the ID of the Volume by Price study and SG3 is the Volume Area Area High subgraph. This now gives you the value of the previous Value Area High in cell L3. You can then use this as you want. For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing |
[2025-03-31 19:30:43] |
Trade with ICE - Posts: 25 |
so there is no simpler way to reference that subgraph but with a spreadsheet only?
|
[2025-03-31 19:47:01] |
John - SC Support - Posts: 39353 |
It really depends on what you want to do, but in general - that is the best way to get the information into the current bar so you can do what you want with it.
For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing |
[2025-04-01 13:46:21] |
JohnR - User831573 - Posts: 330 |
Another possible solution would be to use persistent variables. In there you can keep Persistent Vars for prior VAH_Prior, VAL_Prior, POC_Prior and variables for current profile VAH_Curr, VAL_Curr, POC_Curr. On each tick look for new profile start (bar #, date/time, whatever). If not new profile, save to the Curr vars. Once a new profile start is found, Move "Curr" vars to "Prior" vars, before updating the "Curr "vars. To do this you would have to code to look for the switch to the new profile start bar. When start new profile bar > old profile start bar # or something like this. Hope this helps. JohnR |
[2025-04-02 16:05:34] |
Trade with ICE - Posts: 25 |
Thanks John... got it working but having trouble retaining the value of that previous vah/val of a profile. im tracking the value of it but once a new profile starts the value changes. im trying to mimic the default study VOLUME VALUE AREA LINES does. i tried using the HIGH/LOW FOR TIME PERIOD STUDY and reference the values i got from the spreadsheet. is there a way i can retain the values of the vah/val so i can reference them? JohnR way is way too complicated... for me at least. |
Attachment Deleted. ![]() |
[2025-04-02 16:40:34] |
JohnR - User831573 - Posts: 330 |
What I do is I have some code at the beginning/top of --> // Do data processing . It does a compare of the sc.index current bar to saved saved/'prior' bar num. Remember, I am self taught, and there is probably a more elegant way to accomplish this. Here is some code out of my stuff. Hopefully with enough to show you what I did. You will have to define some of the variable. // below block to do your processing ??? you want to execute if end of bar --> which is the first tick of the next bar if (sc.Index > PriorTickBarNum) { // execute this block of code if this is 1st tick of new bar PriorTickBarNum = sc.Index; IsItNewBar = 1; // you may not need this variable // Do what you want. process prior VAH/VAL, etc. Save them to some persistent variables other than Prior variables // I use 2 sets of vars - one set holds the VAH variables during the bar to keep the most recent values // Move PriorTemp vars to PriorVAH, PriorVAL, etc // Do what ever else drawing, processing you want // last thing is to move the VAH, etc to PriorTemp??? vars } else // save the VAH, etc to temp prior variables to keep the most updated VAH, etc of the bar for each new tick { TempPriorVAH = VAH; TempPriorVAL = VAL; // you could either return here or continue on for other processing of this tick } Date Time Of Last Edit: 2025-04-02 16:42:30
|
[2025-04-02 17:31:59] |
John - SC Support - Posts: 39353 |
There is not a way to capture the state of a study and keep it directly handy (i.e. a persistent variable). But, if your profiles are always at the same time, then you can just reference the data you want from the time and date you want in the Spreadsheet. For instance, if your profiles start every day at 09:30 and you want to get the value for the profile from 2 days ago, then you could enter the following: -Cell K3: =IF(AND(INTDATE(A3) = INTDATE(TODAY()) - 2, FRACTIME(A3) = TIME(09, 30, 00)), ID1.SG3@3, 0) -Cell L3: =MOSTRECENTNONZEROVALUE($K$3:$K$2000) For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing |
[2025-04-02 17:33:12] |
Trade with ICE - Posts: 25 |
// below block to do your processing ??? you want to execute if end of bar --> which is the first tick of the next bar
if (sc.Index > PriorTickBarNum) { // execute this block of code if this is 1st tick of new bar PriorTickBarNum = sc.Index; IsItNewBar = 1; // you may not need this variable // Do what you want. process prior VAH/VAL, etc. Save them to some persistent variables other than Prior variables // I use 2 sets of vars - one set holds the VAH variables during the bar to keep the most recent values // Move PriorTemp vars to PriorVAH, PriorVAL, etc // Do what ever else drawing, processing you want // last thing is to move the VAH, etc to PriorTemp??? vars } else // save the VAH, etc to temp prior variables to keep the most updated VAH, etc of the bar for each new tick { TempPriorVAH = VAH; TempPriorVAL = VAL; // you could either return here or continue on for other processing of this tick } This is good but way too complex for my brain. is this code for a custom study? im just using a spreadsheet |
[2025-04-02 18:21:45] |
Sawtooth - Posts: 4205 |
im trying to get the value of the PREVIOUS VAH/VAL.
Use the Spreadsheet Formula study, with a formula like this in its Formula field:=IF(ID1.SG3<>ID1.SG3[-1], ID1.SG3[-1], ID4.SG1[-1]) where ID1 is the VbP study, and ID4 is this Spreadsheet Formula study. This formula finds the change of value, then makes the previous bar's VAH persistent. Date Time Of Last Edit: 2025-04-02 18:23:03
|
[2025-04-02 19:34:08] |
Trade with ICE - Posts: 25 |
Use the Spreadsheet Formula study, with a formula like this in its Formula field:
=IF(ID1.SG3<>ID1.SG3[-1], ID1.SG3[-1], ID4.SG1[-1]) where ID1 is the VbP study, and ID4 is this Spreadsheet Formula study. This formula finds the change of value, then makes the previous bar's VAH persistent. Unfortunately its a syntax error |
[2025-04-02 20:18:12] |
Sawtooth - Posts: 4205 |
Unfortunately its a syntax error
No syntax error for me.Verify the ID#s and edit as needed. Copy/paste again. Date Time Of Last Edit: 2025-04-02 20:19:57
|
[2025-04-02 20:38:12] |
Trade with ICE - Posts: 25 |
ID1.SG3 = PROFILE VAH ID4.SG1 = WAS THE VAH FROM SPREADSHEET FORMULA K COLUMN =IF(ID1.SG3@3 <> ID1.SG3@4, ID1.SG3@4, 0) i tried the ID4.SG3 which is from the spreadsheet formula column =MOSTRECENTNONZEROVALUE($K$3:$K$1000) still im having syntax error |
[2025-04-02 20:52:53] |
Sawtooth - Posts: 4205 |
Use the Spreadsheet Formula study, not the Spreadsheet Study study. Despite its name, the Spreadsheet Formula study is not a spreadsheet study; it uses Alert syntax, not spreadsheet syntax. See post #13. |
[2025-04-02 21:26:17] |
Trade with ICE - Posts: 25 |
thanks ... yea I have the same issue like with the HIGH/LOW FOR TIME PERIOD STUDY. it needs a value of the previous value to be constant so it will not follow the next one. i hope im making sense |
![]() |
[2025-04-02 21:30:31] |
Trade with ICE - Posts: 25 |
i guess it got tracked...(but with a dot) and the line didnt stay there but follow the next
|
![]() |
[2025-04-02 21:36:08] |
Sawtooth - Posts: 4205 |
The formula I offered finds the change of value of the VAH, assuming it changes at the next vol profile. If this assumption doesn't return the value you need to be made persistent, then the formula needs to be altered. What you want to do is possible; it's just a matter of 'finding' the value you want to be persistent. See attached pic for how it looks to me: the persistent value is the dashed cyan line. Date Time Of Last Edit: 2025-04-02 21:38:01
|
![]() |
[2025-04-02 21:55:45] |
Trade with ICE - Posts: 25 |
yea that's what im asking John -SC Support about. I need a column in the spreadsheet that will store the previous value and will remain constant so that when I reference its value, it will not move even when a new profile starts
|
[2025-04-02 22:03:25] |
Sawtooth - Posts: 4205 |
If you want to use the Spreadsheet Study study instead, use this formula in K3: =IF(ID1.SG3@3<>ID1.SG3@4, ID1.SG3@4, K4) |
[2025-04-02 22:03:30] |
Trade with ICE - Posts: 25 |
The formula I offered finds the change of value of the VAH, assuming it changes at the next vol profile.
If this assumption doesn't return the value you need to be made persistent, then the formula needs to be altered. What you want to do is possible; it's just a matter of 'finding' the value you want to be persistent. See attached pic for how it looks to me: the persistent value is the dashed cyan line. how you did this is pretty awesome. im trying to do this for days now i cant figure it out lol |
[2025-04-02 22:10:47] |
Sawtooth - Posts: 4205 |
now i cant figure it out lol
What is the ID# of your VbP study?
|
[2025-04-02 22:23:54] |
Trade with ICE - Posts: 25 |
What is the ID# of your VbP study?
Vbp STUDY = ID1 |
To post a message in this thread, you need to log in with your Sierra Chart account: