Support Board
Date/Time: Thu, 27 Feb 2025 03:12:48 +0000
[Programming Help] - [ACSIL] - Finding out the slope of an MA line
View Count: 910
[2021-06-18 10:22:32] |
backinblack - Posts: 36 |
Hi, On the charts, when I use an MA, I have it configured so it changes color in accordance with its slope. If I am using that MA in a custom study of mine, how do I identify the slope (+/-) using ACSIL please? Thanks K |
[2021-06-18 19:41:01] |
ForgivingComputers.com - Posts: 1015 |
This is how you can do it with the Last (Close) price. Substitute your MA array as needed. int slope = 0;
float Current = sc.BaseDataIn[SC_LAST][sc.Index]; float Previous = sc.BaseDataIn[SC_LAST][sc.Index - 1]; if(Current > Previous) slope = 1; else if (Current < Previous) slope = -1; Then you would switch between primary and secondary colors based on the value of slope. |
To post a message in this thread, you need to log in with your Sierra Chart account: