Support Board
Date/Time: Tue, 04 Nov 2025 04:37:37 +0000
Post From: ACSIL: how to query bar color at runtime
|   [2018-12-02 16:12:21]     |  
| ForgivingComputers.com - Posts: 1153 | 
| 
                 i would like to find the color of the current bar (or a previous bar) using an ACSIL function....i.e whether it is a green (up bar) or red (down bar). 
is there a builtin ACSIL function to do this? if not, any recommendation how to go about getting the bar's color? Subtract the open price from the close/last price and check to see if the bar has closed. If it is positive, then the bar is up, negative means down. int BarColor; 
                if ((sc.BaseDataIn[SC_LAST][sc.Index] - sc.BaseDataIn[SC_OPEN][sc.Index]) >= 0 && sc.GetBarHasClosedStatus() == BHCS_BAR_HAS_CLOSED) BarColor = 1; // Green if ((sc.BaseDataIn[SC_LAST][sc.Index] - sc.BaseDataIn[SC_OPEN][sc.Index]) < 0 && sc.GetBarHasClosedStatus() == BHCS_BAR_HAS_CLOSED) BarColor = 0; // Red  | 
        
