Login Page - Create Account

Support Board


Date/Time: Fri, 19 Apr 2024 03:08:25 +0000



[Programming Help] - I'm getting a syntax error here..

View Count: 707

[2018-12-09 21:51:17]
User917679 - Posts: 76
And can't quite figure it out:


=IF(ABS(J10) <= (ID12.SG1@3)*5, $J$26/2) //placed in row J83

^^ Basically, i'm trying to say here: if position quantity is less than "5 times x variable", then we're going to exit HALF our trade quantity amount... this one is giving me syntax errors..

Second, I need the variable in "ID12.SG1@3" to NOT change in its output throughout the order - such that the initial value gathered from it when the order began is the one that is used 'till the end of that order(if that makes sense)...

Lastly, in the J23/J25 columns, how do you make it so that we're "selling to the bid", and "buying the ask" instead of selling to ask and buying to bid...
Date Time Of Last Edit: 2018-12-09 23:53:27
[2018-12-10 15:15:01]
Sawtooth - Posts: 3973
1. You need another argument. What do you want the exit quantity to be IF(ABS(J10) <= (ID12.SG1@3)*5 is false?
=IF(ABS(J10)<=ID12.SG1@3*5,J26/2,J26)

2. A spreadsheet study cannot store a persistent variable intrabar; It can only create a persistent variable from row to row (bar to bar).
Here are some examples of persistent variables in a spreadsheet study:
Spreadsheet Example Formulas and Usage: Persistent and Incrementing Variables

3. You can reference the current bid and ask prices in J12/J14.
[2018-12-11 03:29:20]
User917679 - Posts: 76
Thanks that helped a lot.

But now, I seem to have another issue where I want to use persistent variables but my syntax is off(?)

example: ID12.SG1@(3+P3) // where I want to use "P3"(programmed w/ incrementing code) to peristently access from row 3 as it was AT BUY ENTRY

Now syntax wise, I'm not sure whats wrong.. if "(3+P3)" is invalid, then what can you put?
[2018-12-11 04:40:19]
Sawtooth - Posts: 3973
You could use the OFFSET function.
=OFFSET(ID12.SG1@3,P3,0)

https://www.sierrachart.com/index.php?page=doc/SpreadsheetFunctions.html#OFFSET_Function

Without knowing exactly what you are doing, this might not be helpful.

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

Login

Login Page - Create Account