// The top of every source code file must include this line #include "sierrachart.h" // For reference, refer to this page: // https://www.sierrachart.com/index.php?page=doc/doc_CreatingDLLs.html // This line is required. Change the text within the quote // marks to what you want to name your group of custom studies. SCDLLName("ETFBender Dev") //This is the basic framework of a study function. SCSFExport scsf_SkeletonFunction(SCStudyInterfaceRef sc) { // Section 1 - Set the configuration variables and defaults if (sc.SetDefaults) { sc.GraphName = "ETF Bender"; // During development set this flag to 1, so the DLL can be rebuilt without restarting Sierra Chart. When development is completed, set it to 0 to improve performance. sc.FreeDLL = 1; sc.GraphRegion = 0; sc.AutoLoop = 0; //Auto looping is enabled. sc.CalculationPrecedence = LOW_PREC_LEVEL; sc.Subgraph[0 ].Name = "Name"; sc.Subgraph[0 ].DrawStyle = DRAWSTYLE_CUSTOM_TEXT; sc.Subgraph[0 ].PrimaryColor = RGB (0, 0, 0); sc.Subgraph[0 ].LineWidth = 8; sc.Subgraph[0 ].LineLabel = LL_DISPLAY_VALUE | LL_VALUE_ALIGN_RIGHT | LL_VALUE_ALIGN_CENTER; sc.Input[0].Name = "Price Correction Factor"; sc.Input[0].SetFloat(498.50f); sc.Input[1].Name = "Price grid points"; sc.Input[1].SetFloat(0.10f); sc.Input[2].SetInt(-1); sc.Input[2].Name = "Offset -DOM use must be neg"; return; } // Section 2 - Do data processing here { s_UseTool Tool_StopLoss; int StartIndex = sc.UpdateStartIndex; //if (StartIndex != 0) { SCDateTime TradingDayStartDateTime = sc.GetTradingDayStartDateTimeOfBar(sc.BaseDateTimeIn[StartIndex]); StartIndex = sc.GetFirstIndexForDate(sc.ChartNumber, TradingDayStartDateTime.GetDate()); for (int x=1;x<20;x++) { Tool_StopLoss.Clear(); Tool_StopLoss.ChartNumber = sc.ChartNumber; Tool_StopLoss.DrawingType = DRAWING_TEXT; Tool_StopLoss.LineNumber = 712343+x; Tool_StopLoss.BeginDateTime = sc.BaseDateTimeIn[sc.ArraySize - sc.Input[2].GetInt()]; Tool_StopLoss.BeginValue = sc.Open[1]+(x*.10); Tool_StopLoss.UseRelativeVerticalValues= false; Tool_StopLoss.Region = 0; Tool_StopLoss.Color = sc.Subgraph[0].PrimaryColor; Tool_StopLoss.FontBold = true; Tool_StopLoss.FontFace = "Lucida Console"; Tool_StopLoss.FontSize = sc.Subgraph[0].LineWidth; Tool_StopLoss.AddMethod = UTAM_ADD_OR_ADJUST; Tool_StopLoss.ReverseTextColor = false; Tool_StopLoss.Text.Format("%4.2f",(float)sc.RoundToTickSize((( sc.Open[1]+(x*.10))*sc.Input[0].GetFloat())/50 , 0.25)); sc.UseTool(Tool_StopLoss); } } } }