Support Board
Date/Time: Fri, 31 Jan 2025 15:59:39 +0000
Post From: How to change bar color from study that on chart region 2
[2019-05-09 18:56:52] |
patternsmart - Posts: 6 |
Here is my code, please let me know why it doesn't paint the price bar. #include "sierrachart.h" SCDLLName("Color Bar") /*==========================================================================*/ SCSFExport scsf_ColorBar(SCStudyInterfaceRef sc) { SCSubgraphRef ColorBar = sc.Subgraph[0]; SCSubgraphRef RSI = sc.Subgraph[1]; if (sc.SetDefaults) { // Set the configuration and defaults sc.GraphName = "Color Bar"; sc.StudyDescription = "This study function colors bars based on RSI"; sc.GraphRegion = 1; ColorBar.Name = "Color Bar"; ColorBar.DrawStyle = DRAWSTYLE_COLOR_BAR; ColorBar.SecondaryColorUsed = 1; // true ColorBar.PrimaryColor = RGB(0,255,255); ColorBar.SecondaryColor = RGB(255, 127, 0); RSI.Name = "RSI"; RSI.DrawStyle = DRAWSTYLE_LINE; RSI.PrimaryColor = RGB(255,127,0); sc.AutoLoop = 1; sc.FreeDLL = 1; return; } // Do data processing sc.RSI(sc.Close, RSI, MOVAVGTYPE_SIMPLE, 14); if (RSI[sc.Index] > 50) { ColorBar[sc.Index] = 1; ColorBar.DataColor[sc.Index] = ColorBar.PrimaryColor; } else { ColorBar[sc.Index] = 1; ColorBar.DataColor[sc.Index] = ColorBar.SecondaryColor; } } |