Support Board
Date/Time: Sat, 01 Feb 2025 03:54:16 +0000
Different formula for last bar when using Spreadsheet Formula study?
View Count: 1299
[2019-06-17 16:33:15] |
User132748 - Posts: 159 |
Hey is there any smart way to define different formula for the last bar in the chart vs other bars when using Spreadsheet Formula study? I dont't know how to detect/reference last bar. It all would be easy when using full spreadsheed - just use IF(ROW()=3,...) clause, but how can I do that in spreadsheed formula study? So lets say formula for all bars in the chart would be ID0.SG2+10, but for the last bar I want it to be ID0.SG2+50. How should I do that? I was thinking about Bars Numbering study, but unfortunately it enumarates bars from oldest to current. It would be great if it could enumrate backwards as option too. Thanks! |
[2019-06-17 16:55:51] |
User132748 - Posts: 159 |
Thats rather dirty method: checking if next bar number received from Bar Numbering study equals 0 (theres no bar after current bar yet) and then base final formula on that (screenshot) Hope you guys have more elegant way. Thanks. |
lastbar.jpg / V - Attached On 2019-06-17 16:55:42 UTC - Size: 170.83 KB - 319 views |
[2019-06-18 03:08:04] |
Sierra Chart Engineering - Posts: 104368 |
You could also create your own study and use this function: sc.EvaluateGivenAlertConditionFormulaAsDouble() 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, *change* to the Teton service: Sierra Chart Teton Futures Order Routing Date Time Of Last Edit: 2019-06-18 03:08:54
|
[2019-06-18 06:37:05] |
User132748 - Posts: 159 |
Sure using ASCIL it would take few seconds to create study returning TRUE on last bar, but I always try first to check if theres any native solution using SC interface. It's good to keep up to date with your developments as it's good for rapid prototyping. Then of course encapsulate the idea into code. So maybe you could add the option to Bar Numbering study of inverse enumeration? So the last bar would have 1 or 0 index? That would work as ROW() function in full spreadsheet. Thanks in advance Date Time Of Last Edit: 2019-06-18 06:38:26
|
[2019-06-18 07:14:32] |
User132748 - Posts: 159 |
Well seems the easiest way is to just check if next price bar is 0... :-) if(ID0.SG1[1]=0,TRUE,FALSE) |
To post a message in this thread, you need to log in with your Sierra Chart account: