Support Board
Date/Time: Fri, 31 Jan 2025 03:21:40 +0000
[Programming Help] - lock variable function issue
View Count: 1979
[2019-04-05 14:15:47] |
User917679 - Posts: 76 |
I'm having trouble with the lock variable function not triggering fully accurately at times.. I might have an AND() clause where it contains "@4 to @4"/"@4 to @5" along with my "@3" stipulation(s), but the @4's and @5's seem to not always evaluate in the clause(under spreadsheets' logic details) for some reason... So for example: OR( AND(ID74.SG1@4<ID74.SG1@5, ID84.SG1@3<ID84.SG1@4, ID78.SG1@3<ID78.SG2@3, ID33.SG8@4>ID33.SG7@4) ,V3>0) ^^ I would have something like the above, and once an "@3" attribute within the AND() clause triggers, the rest seems to not evaluate(according to the details window) where I in fact want it to obviously In the details window screen, I see the "V3"(or equivalent when looking back down the cell column) with a "1"/TRUE value in it, meaning that it skipped the rest of the clause and is now fixed as TRUE(?) I'm just a bit confused here tbh.. |
result.png / V - Attached On 2019-04-05 14:06:23 UTC - Size: 31.76 KB - 307 views |
[2019-04-05 17:37:05] |
Sierra Chart Engineering - Posts: 104368 |
The evaluation would not occur for the sub expressions as soon as one of the AND sub expressions is false. This is for efficiency.
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 |
[2019-04-05 17:55:59] |
User917679 - Posts: 76 |
Hmm I guess what I'm wondering now, is why the V3(highlighted in the red box in the picture) would now equal 1 where the rest of the clause hasn't even been made true yet... |
[2019-04-05 18:37:10] |
Sawtooth - Posts: 4164 |
If any of the ANDs are false, it stops evaluating, and returns FALSE. If either of the ORs are true, it stops evaluating, and returns TRUE. Date Time Of Last Edit: 2019-04-05 18:39:04
|
[2019-04-05 19:26:26] |
User917679 - Posts: 76 |
If either of the ORs are true, it stops evaluating, and returns TRUE.
Right, but for example, in the code corresponding to the detail analysis image: OR( AND(ID33.SG8@4>ID33.SG7@4,ID25.SG1@4>ID25.SG4@4,ID68.SG1@4>ID68.SG4@4,ID51.SG1@4>ID51.SG4@4,ID51.SG1@5>ID51.SG4@5,ID51.SG1@6>ID51.SG4@6,ID72.SG1@4>ID72.SG4@4,ID74.SG1@4<ID74.SG1@5,ID84.SG1@4<ID84.SG1@5),OR( AND(ID85.SG1@7>ID85.SG4@7,ID86.SG1@7>ID86.SG4@7,ID33.SG8@4>ID33.SG7@4,ID72.SG1@3>ID72.SG4@3,ID68.SG1@3>ID68.SG4@3,ID74.SG1@4<ID74.SG1@5,ID84.SG1@3<ID84.SG1@4,ID78.SG1@3<ID78.SG2@3) ,V3>0) ) In my case above, it seems that when the first and second "AND()" clauses went false, V3 still came up with a TRUE reading somehow(?) I don't see where/why V3 became true tbh.. Is it possible that the spreadsheet program is carrying over the "previous V3's" TRUE via some strange delay? |
[2019-04-05 20:49:56] |
Sawtooth - Posts: 4164 |
Is it possible that the spreadsheet program is carrying over the "previous V3's" TRUE via some strange delay?
Does a Chart >> Recalculate clear the anomaly?
|
[2019-04-05 22:18:31] |
User917679 - Posts: 76 |
No, the issue remains I just actually tried removing the OR lock clause around the "AND()" clause, and as expected, V3 stays false.. And again for some reason, upon adding the lock back, V3 finds itself as TRUE again... |
[2019-04-05 22:32:05] |
Sawtooth - Posts: 4164 |
Explain the lock clause please. Can you share the V3 formula?
|
[2019-04-05 22:59:18] |
User917679 - Posts: 76 |
OR( AND(ID33.SG8@4>ID33.SG7@4,ID25.SG1@4>ID25.SG4@4,ID68.SG1@4>ID68.SG4@4,ID51.SG1@4>ID51.SG4@4,ID51.SG1@5>ID51.SG4@5,ID51.SG1@6>ID51.SG4@6,ID72.SG1@4>ID72.SG4@4,ID74.SG1@4<ID74.SG1@5,ID84.SG1@4<ID84.SG1@5),OR( AND(ID85.SG1@7>ID85.SG4@7,ID86.SG1@7>ID86.SG4@7,ID33.SG8@4>ID33.SG7@4,ID72.SG1@3>ID72.SG4@3,ID68.SG1@3>ID68.SG4@3,ID74.SG1@4<ID74.SG1@5,ID84.SG1@3<ID84.SG1@4,ID78.SG1@3<ID78.SG2@3) ,V3>0) )
^^This is essentially the formula section thats acting up.. and by lock clause, I was refering to the lock in the code formation from above: "OR( AND(), OR( AND(),V3>0) )" to basically lock the whole secondary condition if it becomes TRUE. In the main formula, I put the "ID74.SG1@4<ID74.SG1@5" of the second "AND()" in bold to just to highlight that this condition is NOT met in the image example(nor is the first), and therefore the rest of the statement should NEVER ring true Again, its strange because from the image I sent, the spreadsheet asserts correctly that neither AND() is true - So the V3 being TRUE(in the red box of picture) confuses me... |
[2019-04-05 23:10:48] |
Sawtooth - Posts: 4164 |
If you are using this concept...: https://www.sawtoothtrade.com/example-9.html Spreadsheet Studies Special Tasks: Locking the State of a One Time Condition ...then the locked cell should be in a static cell (e.g., column H or row 1) not in a Formula Column. Then reference the locking cell in another formula. Locking and unlocking a locking cell with formulas can be tricky because of the need to alternate to FALSE, then to TRUE, to set up the next lock. You might need to separate each portion in separate Formula Columns to isolate the trouble. |
[2019-04-06 17:18:32] |
User917679 - Posts: 76 |
I will try the things you suggested. Thanks The "OR( AND(), OR( AND(),V3>0) )" is based on the simple lock code described in the tutorial as "=OR(E3=10,K3>0)". Was it viable to use it in the way that I did: "=OR(V3=1,V3>0)"? ..I was attempting to lock the "@3s" of the second AND() clause in place but using it in the same cell... I guess that was some sort of gross misinterpretation of its function on my part, because typing it back to myself now, I'm seeing it to appear super-redundant looking.. |
[2019-04-06 17:49:36] |
Sawtooth - Posts: 4164 |
The condition you want to lock TRUE needs to be separate and in its own Formula Column, e.g. P3. Then, use this example formula in H3: =AND(OR(H3=TRUE,P3=1),H5). You'll need a separate formula to toggle the H5 portion to reset it for the next lock. (It doesn't need to be in H5.) This is the tricky part because P3 has to go FALSE (it usually does, hence the need to lock it TRUE), and the H5 portion has to toggle to FALSE then back to TRUE. Then reference $H$3 in your other formula that needs this condition to be locked TRUE. |
To post a message in this thread, you need to log in with your Sierra Chart account: