Support Board
Date/Time: Tue, 22 Apr 2025 05:26:00 +0000
[Programming Help] - Donchian Channel
View Count: 377
[2023-02-23 20:19:33] |
User509820 - Posts: 69 |
Hello, I am trying to change the donchian channel to create the the channel using the body of the candles instead of the high/lows. For example highest open/close for the top and lowest open/close for bottom channel. Is there a way to create this custom study?
|
[2023-02-23 20:43:42] |
John - SC Support - Posts: 39395 |
You would have to modify the source code to do this. This study is available in the file studies7.cpp which is located in your ACS_Source folder under the main Sierra Chart folder. Refer to the following for how to build a custom study: How to Build an Advanced Custom Study from Source Code For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing |
[2023-02-24 18:40:31] |
User509820 - Posts: 69 |
Found it, what exactly would I need to change to get it to perform this way indicated. SCSFExport scsf_DonchianChannel(SCStudyInterfaceRef sc) { SCSubgraphRef Subgraph_HighestHigh = sc.Subgraph[0]; SCSubgraphRef Subgraph_LowestLow = sc.Subgraph[1]; SCSubgraphRef Subgraph_Midline = sc.Subgraph[2]; SCInputRef Input_Length = sc.Input[3]; SCInputRef Input_UseClose = sc.Input[4]; if (sc.SetDefaults) { sc.GraphName = "Donchian Channel"; sc.GraphRegion = 0; sc.AutoLoop = true; Subgraph_HighestHigh.Name= "Highest High"; Subgraph_HighestHigh.DrawStyle= DRAWSTYLE_LINE; Subgraph_HighestHigh.DrawZeros= true; Subgraph_HighestHigh.GraphicalDisplacement= 1; Subgraph_LowestLow.Name = "Lowest Low"; Subgraph_LowestLow.DrawStyle= DRAWSTYLE_LINE; Subgraph_LowestLow.DrawZeros= true; Subgraph_LowestLow.GraphicalDisplacement= 1; Subgraph_Midline.Name = "Mid Line"; Subgraph_Midline.DrawStyle= DRAWSTYLE_LINE; Subgraph_Midline.LineStyle= LINESTYLE_DOT; Subgraph_Midline.DrawZeros= true; Subgraph_Midline.GraphicalDisplacement= 1; Input_Length.Name = "Length "; Input_Length.SetInt(5); Input_Length.SetIntLimits(1, MAX_STUDY_LENGTH); Input_UseClose.Name = "Use Close instead of High and Low"; Input_UseClose.SetYesNo(false); return; } float Lowest = FLT_MAX; float Highest = -FLT_MAX; if (Input_UseClose.GetYesNo()) { for (int BarIndex = sc.Index - (Input_Length.GetInt() - 1); BarIndex <= sc.Index; BarIndex++) { Highest = (Highest < sc.Close[BarIndex]) ? sc.Close[BarIndex] : Highest; Lowest = (Lowest > sc.Close[BarIndex]) ? sc.Close[BarIndex] : Lowest; } } else { for (int BarIndex = sc.Index - (Input_Length.GetInt() - 1); BarIndex <= sc.Index; BarIndex++) { if (Highest < sc.High[BarIndex]) Highest = sc.High[BarIndex]; if (Lowest > sc.Low[BarIndex]) Lowest = sc.Low[BarIndex]; } } Subgraph_HighestHigh[sc.Index] = Highest; Subgraph_LowestLow[sc.Index] = Lowest; Subgraph_Midline[sc.Index] = (Highest + Lowest)/2.0f; } |
To post a message in this thread, you need to log in with your Sierra Chart account: