Support Board
Date/Time: Sun, 11 Jan 2026 20:17:53 +0000
Post From: square offset LR for candlestick - dynamic sizing
| [2026-01-10 05:56:11] |
| Bedhog - Posts: 184 |
|
Hello, rather than create 20+ color bar based on alert condition studies, i'm trying to write a dll that selects the inputs, and measures their values, then outputs a square in a corner TL TR BL BR with a variable size and color. The code is able to output variable size points on HL but i want 4 squares 1 in each corner. The script can output squares px1 but not variable sizes. Is this even possible? if (sc.SetDefaults) { sc.GraphName = "NQ HUD: 4-Corner Woodies V4"; sc.AutoLoop = 1; sc.GraphRegion = 0; InTL.Name = "TL: Woodies Study"; InTL.SetStudySubgraphValues(5, 1); InTR.Name = "TR: Woodies Study"; InTR.SetStudySubgraphValues(7, 1); InBL.Name = "BL: Woodies Study"; InBL.SetStudySubgraphValues(9, 1); InBR.Name = "BR: Woodies Study"; InBR.SetStudySubgraphValues(11, 1); sc.Subgraph[0].Name = "TL: Splat"; sc.Subgraph[0].DrawStyle = DRAWSTYLE_SQUARE_OFFSET_LEFT_FOR_CANDLESTICK; sc.Subgraph[1].Name = "TR: Splat"; sc.Subgraph[1].DrawStyle = DRAWSTYLE_SQUARE_OFFSET_RIGHT_FOR_CANDLESTICK; sc.Subgraph[2].Name = "BL: Splat"; sc.Subgraph[2].DrawStyle = DRAWSTYLE_SQUARE_OFFSET_LEFT_FOR_CANDLESTICK; sc.Subgraph[3].Name = "BR: Splat"; sc.Subgraph[3].DrawStyle = DRAWSTYLE_SQUARE_OFFSET_RIGHT_FOR_CANDLESTICK; return; } for (int i = 0; i < 4; i++) { SCFloatArray SG1_CCI, SG2_Red, SG4_Blue; sc.GetStudyArrayFromChartUsingID(sc.ChartNumber, sc.Input.GetStudyID(), sc.Input.GetSubgraphIndex(), SG1_CCI); sc.GetStudyArrayFromChartUsingID(sc.ChartNumber, sc.Input.GetStudyID(), 2, SG2_Red); sc.GetStudyArrayFromChartUsingID(sc.ChartNumber, sc.Input.GetStudyID(), 4, SG4_Blue); // Vertical Anchor: High for Top, Low for Bottom sc.Subgraph[sc.Index] = (i < 2) ? sc.High[sc.Index] : sc.Low[sc.Index]; // Color Logic based on Woodies Trend if (SG4_Blue[sc.Index] != 0) sc.Subgraph.DataColor[sc.Index] = RGB(0, 255, 0); else if (SG2_Red[sc.Index] != 0) sc.Subgraph.DataColor[sc.Index] = RGB(255, 0, 0); else sc.Subgraph.DataColor[sc.Index] = RGB(255, 255, 255); // White Neutral // MOMENTUM "SPLAT" CALCULATION float absVal = fabsf(SG1_CCI[sc.Index]); int splatSize = 1; if (absVal >= 200.0f) splatSize = 12; // Level 3 else if (absVal >= 100.0f) splatSize = 7; // Level 2 else if (absVal >= 50.0f) splatSize = 4; // Level 1 else splatSize = 2; // Neutral // For Offset DrawStyles, we use the primary array for width per bar sc.Subgraph.Arrays[0][sc.Index] = (float)splatSize; } Date Time Of Last Edit: 2026-01-10 06:00:33
|
| |
