Support Board
Date/Time: Sun, 19 May 2024 15:32:45 +0000
How can I reference Moving Average in the ALERT
View Count: 1352
[2020-01-03 21:53:05] |
sourdubber - Posts: 52 |
How can I use the reference function in the alert? For example, I would like an alert based on this simple formula: TriggerAlert = (close - close[1]) > (simple moving average - simple moving average[1]); (Sorry, my knowledge of spreadsheet is pretty basic. Thanks in advance for your help.) |
[2020-01-03 23:30:14] |
Ackin - Posts: 1865 |
=(c-c[-1])>(IDxx.SG1-IDxx.SG1[-1]) where IDxx is ID of the simple moving average Date Time Of Last Edit: 2020-01-03 23:39:38
|
[2020-01-03 23:44:06] |
John - SC Support - Posts: 31733 |
We are not sure exactly what you are wanting to do. Ackin has given you one option. You will find the documentation for referencing previous bars in an alert here: Study/Chart Alerts And Scanning: Referencing Data Other Than on the Last Bar/Column In the Chart And here is the documentation for referencing a Study Subgraph (the Moving Average - Simple, in your case) - also read the section immediately after this one as well: Study/Chart Alerts And Scanning: Referencing Study Subgraphs If there is something else you need, please specify further. For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing |
[2020-01-04 00:37:01] |
sourdubber - Posts: 52 |
Thank you! (Wow that look so simple in hindsight. LOL) Another noob question. Is there a way to plot the formulas on the chart for verification? For instance, plot (simple moving average - simple moving average[1]) as a line on the lower chart as a visual reference? |
[2020-01-04 00:50:03] |
Ackin - Posts: 1865 |
You can do these calculations. Refer to: Using the Basic Arithmetic Studies |
[2020-01-04 03:25:01] |
sourdubber - Posts: 52 |
Thanks for the pointer. It looks easy but I've already run into a problem. I am using the Study Subgraphs Subtract Difference to subtract SMA - SMA[1]. But how can I insert the offset of SMA[1] (ie. SMA one bar ago)? There is the offset option but I only want to apply the offset to one of the SMA, not both. Please click the link to see the image. https://www.sierrachart.com/Download.php?Folder=SupportBoard&download=34257 |
Annotation 2020-01-03 191745.png / V - Attached On 2020-01-04 03:18:10 UTC - Size: 87.33 KB - 300 views |
[2020-01-04 03:33:05] |
Ackin - Posts: 1865 |
But how can I insert the offset of SMA[1] (ie. SMA one bar ago)?
Offset value - This is always converted to a positive value and is the number of bars back
Date Time Of Last Edit: 2020-01-04 03:49:26
|
[2020-01-04 03:53:30] |
sourdubber - Posts: 52 |
Offset value - This is always converted to a positive value and is the number of bars back
So going back to the example of "SMA - SMA[1]", do I need to create two different studies? I tried to create one study with just SMA and another with the offset of 1 (SMA[1]). But I didn't see any parameter setting for the offset. How would I plot, say, "close x bar(s) ago"? BTW Is there not a way to plot the spreadsheet formula (for example, the one that wrote above) directly on the chart? Thanks. |
[2020-01-04 04:15:46] |
Ackin - Posts: 1865 |
do I need to create two different studies?
No... the inputs can be the same they are two different storagesDescriptions for this study: Study Subgraphs Subtract/Difference The values from input 1 are stored in array1 The values from input 2 are stored in array2 result = array1[current bar] - array2[current bar - offset] btw. How would I plot, say, "close x bar(s) ago"
look on attached file, I did this as universal solution for: Referencing prior bars in Studiesmore info: Ackin's indicators (SCH users requests for studies) - Update list | Post: 175860 Date Time Of Last Edit: 2020-01-04 04:29:59
|
image_3726.png / V - Attached On 2020-01-04 04:26:07 UTC - Size: 15.27 KB - 236 views |
To post a message in this thread, you need to log in with your Sierra Chart account: