Login Page - Create Account

Support Board


Date/Time: Wed, 22 Oct 2025 03:39:04 +0000



Automated Trading Formula help

View Count: 76

[2025-10-16 05:22:25]
User4930 - Posts: 1
Could someone tell me if my syntax is correct for the following alert formula:

I want to place a buy alert if the CCI closes above the 2 moving averages:
=AND(ID2.SG2[-1] > ID1.SG2[-1], ID2.SG2[-1]>ID3.SG2[-1])

and a sell alert if the CCI closes below:
=AND(ID2.SG2[-1] < ID1.SG2[-1], ID2.SG2[-1]<ID3.SG2[-1])

This picture shows one example of when a buy and sell would be placed:
www.sierrachart.com/Download.php?Folder=SupportBoard&download=128202

This shows my Study IDs:
www.sierrachart.com/Download.php?Folder=SupportBoard&download=128203

I have spent too many hours on this to no avail.
imagecci-screenshot.png / V - Attached On 2025-10-16 05:15:34 UTC - Size: 138.52 KB - 18 views
imagestudies-screenshot.png / V - Attached On 2025-10-16 05:18:03 UTC - Size: 63.81 KB - 17 views
[2025-10-16 13:25:51]
Sawtooth - Posts: 4278
Could someone tell me if my syntax is correct for the following alert formula:
The subgraph of the CCI and both MAs is SG1, not SG2.
Try this:
=AND(ID2.SG1[-1] > ID1.SG1[-1], ID2.SG1[-1]>ID3.SG1[-1])

However, you'll probably want to use something like these instead:

=OR(
AND(CROSSFROMBELOW(ID2.SG1,ID1.SG1),ID2.SG1>ID3.SG1),
AND(CROSSFROMBELOW(ID2.SG1,ID3.SG1),ID2.SG1>ID1.SG1))

=OR(
AND(CROSSFROMABOVE(ID2.SG1,ID1.SG1),ID2.SG1<ID3.SG1),
AND(CROSSFROMABOVE(ID2.SG1,ID3.SG1),ID2.SG1<ID1.SG1))

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account