Login Page - Create Account

Support Board


Date/Time: Fri, 03 May 2024 04:28:58 +0000



[User Discussion] - Spradshet Formula Study

View Count: 571

[2020-05-06 05:29:19]
CMG - Posts: 179
Hello,
Simple syntax question but couldn't figure it out with SC documentation.
1. Using the spreadsheet formula study, I'm trying to reference the last price of an specific time within the chart using this syntax in the formula with no luck:
C[BARTIME=TIME(9.45.0)]
2. Also, trying to reference the same value at another study in the chart, but couldn't even get the last price for that study. The study is ID:1. Tried C(ID1), C(ID:1) and all king of combinations but no no luck referencing the ID1 study.
Thanks
[2020-05-06 13:29:34]
Sawtooth - Posts: 3992
The Spreadsheet Formula study uses Simple Alert syntax, despite its name. Here is the documentation for that format:
Study/Chart Alerts And Scanning: Alert Condition Formula Format

You'll need to create a persistent value of the Last price at the close of the bar's BARTIME, like this:
=IF(BARTIME=TIMEVALUE("09:45:00"),C,ID2.SG1[-1])
where ID2 is the Spreadsheet Formula study.

If you want the value of a study subgraph at the close of the bar's BARTIME:
=IF(BARTIME=TIMEVALUE("09:45:00"),ID1.SG1,ID2.SG1[-1])
where the study and its subgraph are ID1.SG1
Date Time Of Last Edit: 2020-05-06 19:38:12
[2020-05-07 03:25:53]
CMG - Posts: 179
Tom,
As always thanks for your help.
I think that I didn't post my question correctly.
I was not trying to get the Last Price at 9:45:00 (when the time was 9:45:00), but what I meant is that I wanted to "retrieve the value" of "the last" printed at 9:45:00 at any time after 9:45:00.
I need the value of the last at 9:45:00, as a constant, to use it in a calculation to see the price difference at any time after 9:45:00, with the then current last price.
E.g. AT 11:00:00, I will like to know the difference between the current last (last at 11:00:00) and the last price at the 9:45:00 bar.

And the same for another study in the chart, which I suppose is the formula for the above but for ID1.SG1

Couldn't find an explanation or example for this within the documentation. Do you think this is possible with spreadsheet formulas?

Thanks again
[2020-05-07 03:39:48]
Sawtooth - Posts: 3992
If you want the price at the open of the 9:45 bar, use this:
=IF(BARTIME=TIMEVALUE("09:45:00"),O,ID2.SG1[-1])
This formula brings the price at 9:45 to every bar from 9:45 to the current bar, so you could compare it continually to the current price.

To get the value of a study subgraph at 9:45, you'd have to use the close of the previous bar's BARTIME. So if you are using a 15 min chart, use this:
=IF(BARTIME=TIMEVALUE("09:30:00"),ID1.SG1,ID2.SG1[-1])
This formula brings the subgraph value at the close of the 9:30 bar to every bar thereafter to the current bar, so you could compare it continually to its current value.

You can also do this with a spreadsheet study, but it might not be necessary if using the Spreadsheet Formula study works for you.

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

Login

Login Page - Create Account