Support Board
Date/Time: Mon, 25 Nov 2024 12:22:11 +0000
Post From: Dynamic Fib Retracement
[2014-01-30 05:36:51] |
User29662 - Posts: 76 |
As a test for what I want to do, I tried to create a simple study that would draw a line. The start point is inputted by the user in the study settings. After that, the line is meant to be dynamically drawn/redrawn to the highest high following the start bar. The code compiled but is not drawing anything. This is my first attempt at ACSIL. Any help/advice would be appreciated. Here's the code: #include "sierrachart.h"
SCDLLName("DLT DLL") SCSFExport scsf_DynamicLineTest(SCStudyGraphRef sc) { SCInputRef SwingLowBar = sc.Input[0]; if (sc.SetDefaults) { sc.GraphName = "DLT"; sc.GraphRegion = 0; sc.FreeDLL = 1; sc.AutoLoop = 1; SwingLowBar.Name = "SwingLowBar"; SwingLowBar.SetInt(0); return; } int StartBar; int EndBar; float StartPrice; float EndPrice; StartBar = SwingLowBar.GetInt(); if (sc.Index < StartBar) return; if (sc.Index == StartBar) { StartPrice = sc.Low[sc.Index]; EndPrice = sc.High[sc.Index]; } if (sc.Index > StartBar) { EndPrice = max(sc.High[sc.Index], EndPrice); if (EndPrice == sc.High[sc.Index]) { EndBar = sc.Index; const int UniqueLineNumber =57683545; if (sc.LastCallToFunction) { sc.DeleteUserDrawnACSDrawing(sc.ChartNumber, UniqueLineNumber + 21); return; } s_UseTool Tool; Tool.Clear(); Tool.ChartNumber = sc.ChartNumber; Tool.DrawingType = DRAWING_LINE; Tool.LineNumber = UniqueLineNumber+1; Tool.BeginIndex = StartBar; Tool.EndIndex = EndBar; Tool.BeginValue = StartPrice; Tool.EndValue = EndPrice; Tool.Color = RGB(255,0,255); Tool.AddMethod = UTAM_ADD_OR_ADJUST; sc.UseTool(Tool); } } } |