Support Board
Date/Time: Fri, 27 Dec 2024 00:51:59 +0000
[User Discussion] - #SYNTAX error on Spreadsheet for trading system study
View Count: 1358
[2015-12-21 13:08:43] |
User740483 - Posts: 6 |
Hey there, Maybe someone can help me with my code. I have looked it up and down and cannot see the problem for some reason. It works for my "color bar based on alert condition" studies. The only thing I changed was the O,H,L,C in my code to the ID2.SG1,ID2.SG2..etc, that it shows in the spreadsheet for the OHLC values of the chart. There is only one set of parenthesis. just brainstorming, but does the spreadsheet function still have the ability to do the 1 bar back [-1] or forward [1]? I figure it can, but I really dont know what else the problem could be. Screenshot:https://dl.dropboxusercontent.com/u/2255790/Untitled22.png Buy Entry =AND(ID3.SG12<=-4,ID3.SG12[-1]<=-4,ID3.SG12[1]>=-4,ID1.SG1<ID2.SG4,ID23.SG3<ID2.SG4,ID23.SG2<ID2.SG4) Sell Entry =AND(ID3.SG7>=4,ID3.SG7[-1]>=4,ID3.SG7[1]<=4,ID1.SG1>ID2.SG4,ID23.SG3>ID2.SG4,ID23.SG2>ID2.SG4) If anyone could help that would be amazing! thanks! Date Time Of Last Edit: 2015-12-21 13:08:52
|
[2015-12-21 13:43:44] |
User740483 - Posts: 6 |
Ok, so I have corrected my code by looking up the step by step guide. (which is great, btw) but now the problem is that, I have adjusted the code to what i would think would be correct for the spreadsheet, but the arrows showing where trades would be are not accurate. Here is a screenshot of what i mean. I have the original code that is working for my color bar based on alert condition study here: =AND(ID3.SG12<=-4,ID3.SG12[-1]<=-4,ID3.SG12[1]>=-4,ID1.SG1<C,ID23.SG3<C,ID23.SG2<C) Spreadsheet buy entry: =AND(ID3.SG12@4<=-4,ID3.SG12@3<=-4,ID3.SG12@5>=-4,ID1.SG1@4<ID2.SG4@4,ID23.SG3@4<ID2.SG4@4,ID23.SG2@4<ID2.SG4@4) Did i translate the code wrong? I'm not sure why the signals are different for the spreadsheet and dont match the chart. Date Time Of Last Edit: 2015-12-21 14:15:00
|
Signals problem.png / V - Attached On 2015-12-21 14:14:35 UTC - Size: 206.13 KB - 379 views |
[2015-12-21 14:11:48] |
Sawtooth - Posts: 4143 |
Either change the 'Formula Source Sheet Number' to match the sheet where the formulas are, or put the formulas on the Sheet# that matches the chart#.
|
[2015-12-21 14:15:29] |
User740483 - Posts: 6 |
thank you, yes i got that one figured out just a few seconds ago. I have the original code that is working for my color bar based on alert condition study here: =AND(ID3.SG12<=-4,ID3.SG12[-1]<=-4,ID3.SG12[1]>=-4,ID1.SG1<C,ID23.SG3<C,ID23.SG2<C) Spreadsheet buy entry: =AND(ID3.SG12@4<=-4,ID3.SG12@3<=-4,ID3.SG12@5>=-4,ID1.SG1@4<ID2.SG4@4,ID23.SG3@4<ID2.SG4@4,ID23.SG2@4<ID2.SG4@4) Did i translate the code wrong? I'm not sure why the signals are different for the spreadsheet and dont match the chart. Date Time Of Last Edit: 2015-12-21 14:17:02
|
Signals problem.png / V - Attached On 2015-12-21 14:16:59 UTC - Size: 206.13 KB - 351 views |
[2015-12-21 14:50:06] |
Sawtooth - Posts: 4143 |
Each spreadsheet row is a chart bar with row 3 the current bar and previous bars below. So all of the [-1]s will use @4, and the others all @3, except the [1]. Also, the OHLC are all ID0: =AND(ID3.SG12@3<=-4,ID3.SG12@4<=-4,ID3.SG12@2<=-4,ID1.SG1@3<ID0.SG4@3,ID23.SG3@3<ID0.SG4@3,ID23.SG2@3<ID0.SG4@3) The ID3.SG12[1]>=-4 is a future bar and this would be row2, except this will give an error in row 3. You can trap the error with this, forcing it to FALSE: =IF(ROW()=3,FALSE,AND(ID3.SG12@3<=-4,ID3.SG12@4<=-4,ID3.SG12@2<=-4,ID1.SG1@3<ID0.SG4@3,ID23.SG3@3<ID0.SG4@3,ID23.SG2@3<ID0.SG4@3)) |
[2015-12-21 15:04:12] |
Sawtooth - Posts: 4143 |
You can also use the traditional cell references, which is visually much tidier, but requires that you not add, remove or rearrange studies in the Studies to Graph list: =IF(ROW()=3,FALSE,AND(AN3<=-4,AN4<=-4,AN2<=-4,AA3<E3,AR3<E3,AQ3<E3)) where: ID3.SG12 is in column AN ID1.SG1 is in column AA ID23.SG3 is in column AR ID23.SG2 is in column AQ |
[2015-12-21 17:08:15] |
User740483 - Posts: 6 |
I ended up doing something like that, but i basically used @4 instead of @3 so that i could have the 1 previous bar and 1 future bar. So technically @4 is the signal but doesn't show up until @3. If anyone knows a way around this that would be cool to. Im deffinitly open to suggestion/new ideas. Buy Signal updated: =AND(ID3.SG12@5<=-4,ID3.SG12@4<=-4,ID3.SG12@3>=-4,ID1.SG1@4<ID2.SG4@4,ID23.SG3@4<ID2.SG4@4,ID23.SG2@4<ID2.SG4@4) I tried what you said about the IF(ROW()=3,False, but it didnt work for me. My signals actually disappeared when i tried adding and tweaking with that. Visually that does look better the other way, but I want to keep it in terms that i can know and remember easier, and having the ID.SG. type thing is just easier for me even though it does look atrocious. Thanks for your help! And if anyone has any other input on maybe a way that i dont have to be lagging a bar to get my signal that would be great |
To post a message in this thread, you need to log in with your Sierra Chart account: