Support Board
Date/Time: Wed, 27 Nov 2024 08:39:44 +0000
Spreadsheet syntax vs Alert syntax for price bar colors
View Count: 508
[2023-08-31 16:20:19] |
Sawtooth - Posts: 4120 |
This spreadsheet formula: =IF(OR(E3>B3,AND(B3>E4,B3=E3)),1, IF(OR(E3<B3,AND(B3<E4,B3=E3)),-1,T4)) taken from here: Spreadsheet Example Formulas and Usage: Formula that Matches the Coloring of Up and Down Price Bars correctly finds price bar colors. This same formula, converted to Alert syntax for use in the Spreadsheet Formula study, incorrectly gives the inverse color at doji price bars: =IF(OR(C>O,AND(O>C[-1],O=C)),1, IF(OR(C<O,AND(O<C[-1],O=C)),-1,ID1.SG1[-1])) where ID1 is this Spreadsheet Formula study. Can you offer an explanation why please? Date Time Of Last Edit: 2023-08-31 18:48:14
|
Spreadsheet syntax vs Alert syntax.PNG / V - Attached On 2023-08-31 16:20:02 UTC - Size: 47.64 KB - 110 views |
[2023-08-31 18:31:44] |
John - SC Support - Posts: 36309 |
The one thing we can tell you is that the situation where things are different is where the Open and Close are equal within the bar. You would have to figure out what about the formula creates this situation. For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing |
[2023-08-31 18:40:55] |
Sawtooth - Posts: 4120 |
The one thing we can tell you is that the situation where things are different is where the Open and Close are equal within the bar.
My question is: Why does the Spreadsheet formula correctly deal with it, but the Alert formula does not.They are the same formula, in different syntaxes. |
[2023-08-31 18:52:43] |
Sawtooth - Posts: 4120 |
Update: Both syntaxes work, except on Heikin-Ashi bars. Only the Spreadsheet syntax works correctly on Heikin-Ashi bars. Date Time Of Last Edit: 2023-09-02 16:48:07
|
[2023-09-07 19:13:25] |
John - SC Support - Posts: 36309 |
Hi Tom, Sorry, I did not realize this was you asking the question until a few days ago. I finally had a chance to dig into this a bit, but I am not seeing what you are stating. To begin with, I am getting the exact same results with either formula with a standard chart. With the Heikin-Ashi there is one situation where there is a divergence, and for me it is with the Spreadsheet not working properly. The particular case is where the current bar's Open is equal to the Close (a Doji bar - sorry I missed that in your original statement) and the Open of the current bar is equal to the close of the previous bar. In this case, none of the entries are true, so it should fall through to the final "False" entry. But, since the Spreadsheet uses Floating Point values, the Close and the Open are NOT exactly equal to each other, so one or the other of the True parameters works and hence there is a different result. Let me know if you need me to look at this further. For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing |
To post a message in this thread, you need to log in with your Sierra Chart account: