Support Board
Date/Time: Fri, 18 Apr 2025 06:47:26 +0000
[Programming Help] - Creating Alert Issue
View Count: 101
[2025-03-24 16:39:41] |
User792637 - Posts: 7 |
Hi I'm struggling to get a simple alert formula to work =OR(AND(CROSSFROMABOVE ID3, ID1<ID2), AND(CROSSFROMBELOW ID3, ID1>ID2)) Where: ID1 is 20MA ID2 is 50MA ID3 is stochastic Crossover System I'm trying to trigger an alert when the 20ma < 50ma and the Stochastic crosses down OR 20ma > 50ma and the stochastic crosses up. (The Stochastic Crossover System indicator plots a buy or sell arrow when a cross happens outside the set levels. Typically crossing down from above 70 and crossing up from below 30) Please could someone explain what I'm doing wrong - thank you :) Date Time Of Last Edit: 2025-03-24 16:52:53
|
[2025-03-24 20:36:04] |
John - SC Support - Posts: 39353 |
Here is the formula we think you want (we think we have the crossing as you are wanting it, but it may be the reverse, you need to double check this): =OR(AND(ID3.SG2, ID1.SG1 < ID2.SG1), AND(ID3.SG1, ID1.SG1 > ID2.SG1)) ID3 is the Stochastic Crossover and SG2 is the Sell Subgraph - which is non-zero when Slow %K line crosses the Slow %D line from above and the Slow %K line is above Line 1 (i.e. there is a cross from above). ID1 is the 20 MA and ID2 is the 50 MA, but you need to specify the subgraphs for each of these, hence the .SG1 for each of them. The second AND has the other Buy subgraph from the Stochastic Crossover system. Refer to the following in particular and the section below it: Study/Chart Alerts And Scanning: Referencing Study Subgraphs For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing |
[2025-03-26 09:38:55] |
User792637 - Posts: 7 |
Hi John Thanks for the guidance - it's working perfectly. I added to it so it would look at the last three bars. =OR(AND(ID3.SG2, ID1.SG1 < ID2.SG1), AND(ID3.SG1, ID1.SG1 > ID2.SG1), AND(ID3.SG2[-1], ID1.SG1[-1] < ID2.SG1[-1]), AND(ID3.SG1[-1], ID1.SG1 > ID2.SG1[-1]), AND(ID3.SG2[-2], ID1.SG1[-2] < ID2.SG1[-2]), AND(ID3.SG1[-2], ID1.SG1[-2] > ID2.SG1[-2])) I tried to set a range parameter but it didn't work for the ID3 (stochastics crossover) Many thanks Date Time Of Last Edit: 2025-03-26 10:10:03
|
[2025-03-26 14:34:25] |
John - SC Support - Posts: 39353 |
What exactly did not work? Offhand, your formula looks fine. But there really is not a reason to look at the last 3 bars to see if there is a match for this situation. As new bars are added, they either match the condition or they do not. If they do not, then they are not going to match, so looking at the previous bars does not give any additional information. For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing |
[2025-03-26 14:50:13] |
User792637 - Posts: 7 |
Hi John Adding in a range to look back on the indicator - Example: =AND(ID3.SG2[0:-1], ID1.SG1 < ID2.SG1) doesn't seem to work for the stochastics crossover system. If I use the alert to monitor a live market you are correct there is no need for the extra look back but if I run a scan on a watch list periodically rather than live it does make sense to have it look back more that one bar as I may have missed a previous trigger. Which is what I'm using it for on EOD and 4hr charts. The main thing is it's working as intended and I'm really grateful for you help. |
[2025-03-26 14:54:23] |
John - SC Support - Posts: 39353 |
You cannot use a range like you show in the example (ID3.SG2[0:-1]). This is not a proper usage of the range option. You would have to expand your formula to include the options for checking the current bar and the previous bar individually. It will get a bit long, but it can be done. 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: