Login Page - Create Account

Support Board


Date/Time: Fri, 19 Apr 2024 02:49:19 +0000



Horizontal line color change based on MACD

View Count: 1507

[2019-04-24 23:53:19]
User929084 - Posts: 60
Hi. I would like to add horizontal lines to MACD at 0.5 and -0.5 and have them change color based on MACD line crossing them up or down. So than when MACD crosses above 0.5 it, the horizontal line turns green and when MACD is below it, it turns back to original color. And same thing with -0.5 but when MACD crosses below -0.5 horizontal line, the horizontal line turns red.

I searched around in this forum and and google and didn't find the answer.

Here's the image that shows what I'm trying to accomplish.

Thank you.
imageMACD.png / V - Attached On 2019-04-24 23:50:51 UTC - Size: 9.21 KB - 251 views
[2019-04-25 14:44:20]
John - SC Support - Posts: 30953
You would need to add the Horizontal Lines study to start with, in order to get the lines you want at those levels. Here is the documentation for the Horizontal Lines study:
Horizontal Lines

Then you need to add two Color Bar Based on Alert Condition studies, one for when the MACD is above 0.5 and the other for when the MACD is below -0.5. You will need to setup the Color Bar Based on Alert Condition to change the Horizontal Lines subgraph. All of this is explained in the documentation for the study. You will find the documentation here:
Color Bar Based on Alert Condition

The alert condition is pretty simple, it will just be something like ID1.SG1 > ID2.SG1 where ID1.SG1 is the MACD and ID1.SG1 is the line at 0.5. The other one would be ID1.SG1 < ID2.SG2. You will need to work out the exact IDs and Subgraphs. You will find the information on referencing subgraphs in Alerts here:
Study/Chart Alerts And Scanning: Referencing Study Subgraphs

If all of this is confusing, then look at the following Study Collection that does something similar. You should be able to work from it to get what you want.
https://www.sierrachart.com/AdditionalFiles/ColorCurrentBarLastAboveBelowOpen.StdyCollct

The information for how to use the Study Collection can be found here:
How to Use an Advanced Custom Study or a Study Collection: How to Use a Study Collection
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2019-04-25 22:52:25]
User929084 - Posts: 60
Thank you.

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

Login

Login Page - Create Account