Login Page - Create Account

Support Board


Date/Time: Fri, 26 Apr 2024 23:54:04 +0000



[Programming Help] - spreadsheet syntax error

View Count: 810

[2019-03-13 00:26:49]
Chad - Posts: 231
Need a nudge here to get going...in the default Spreadsheet System for Trading Study, I'm placing a conditional in cell J106 that I want to return '1' (True) if the range of the prior candle/bar's High price, minus the prior Low price, is less than or equal to 4*TICKSIZE (where TICKSIZE is listed by-default in cell J21); else '0' (False). This is what I've input, but it throws a syntax error, whether as-shown or adding spaces between the math operators:

=IF((ID0.SG2[-1]-ID0.SG3[-1])<=(J21*4),1,0)

I also tried this, to same result: =IF((ID0.SG2[-1]-ID0.SG3[-1])<=(TICKSIZE*4),1,0)

Any suggestion?
Date Time Of Last Edit: 2019-03-13 00:28:30
[2019-03-13 01:09:27]
Sawtooth - Posts: 3976
You are using a Simple Alert syntax on a spreadsheet. The spreadsheet syntax is different.
Try this:
=C4-D4<=J21*4
or this:
=ID0.SG2@4-ID0.SG3@4<=J21*4

Notes:
- If the result is Boolean (T/F), you don't need to use the IF function.
- The current bar is in row 3 and previous bars are in rows below.
- When referencing cells in Formula Columns, or in columns A-J, you can use traditional column/row references.
- When referencing study output columns, it is best to use this format:
Working with Spreadsheets: References to Study Subgraph Columns when using the Spreadsheet Study
- SC Engineering might add new system outputs so it is not recommended to use open cells in columns I or J. Column H is open for the user.
Date Time Of Last Edit: 2019-03-13 04:26:26
[2019-03-13 17:12:57]
Chad - Posts: 231
Thank you very much for the help, Tom. The '@4' portion makes sense now too, since you noted current bar as row 3.

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

Login

Login Page - Create Account