Support Board
Date/Time: Tue, 17 Nov 2026 18:19:28 +0000
[Programming Help] - ACSIL: letting a custom study use a left-button drag without scrolling (Pointer/Hand tool)
View Count: 443
| [2026-09-29 13:22:04] |
| Fabio - Posts: 155 |
|
Hello SC support, I hope this email finds you well. My Sierra Chart version: 2953 WHAT I AM BUILDING A custom ACSIL order-entry study. The user arms it with a Custom Study Control Bar button, then on the chart presses the left mouse button at the stop price, drags, and releases at the entry price. The study sizes the position from the stop distance and sends the order. The active tool during normal use is Tools >> Pointer (or Hand). THE PROBLEM With Pointer or Hand active, the left-button drag scrolls the chart. The study does receive the pointer events (sc.ReceivePointerEvents set to ACS_RECEIVE_POINTER_EVENTS_WHEN_ACS_BUTTON_ENABLED, and also tried ACS_RECEIVE_POINTER_EVENTS_ALWAYS), but it cannot stop the chart from scrolling, so the price under the pointer never changes and the drag is unusable. With Tools >> Chart Values active, the same drag works perfectly (no scrolling). WHAT I TRIED 1. Switching the tool from the study to Chart Values when the button is pressed, and back to Pointer afterwards: - sc.SetChartDrawingTool(DRAWING_TOOL_CHART_VALUES) returns 1, but sc.CurrentlySelectedDrawingTool does not change. - sc.SetActiveDrawingTool(sc.ChartNumber, DRAWING_TOOL_CHART_VALUES, 0) returns 0. Same result with the last parameter set to 1. - Both were called on every normal study update for 1.5 seconds after arming, both with the Control Bar button enabled and after disabling it from the study. The tool never changed. - For reference, sc.CurrentlySelectedDrawingTool reports: Pointer = 0, Hand = 52, Chart Values = 2 (these differ from the DRAWING_TOOL_POINTER = 10 / DRAWING_TOOL_CHART_VALUES = 22 / DRAWING_TOOL_HAND = 23 enum values). 2. sc.BlockChartDrawingSelection = 1 while armed: prevents drawing selection but not scrolling. CURRENT WORKAROUND (works, but unsupported) While the study is armed, it subclasses the chart window (SetWindowLongPtr on sc.ChartWindowHandle): it swallows WM_LBUTTONDOWN / WM_LBUTTONUP and removes MK_LBUTTON from WM_MOUSEMOVE, so Sierra Chart never starts its own drag. The original window procedure is restored as soon as the study disarms, on sc.LastCallToFunction and on full recalculation. I would prefer a supported method. QUESTIONS 1. Is there a supported way for a custom study to take over a left-button drag on the chart (like the built-in drawing tools do), so the chart does not scroll, while Pointer or Hand is the selected tool? 2. What is the correct usage of sc.SetChartDrawingTool and sc.SetActiveDrawingTool to switch the active tool to Chart Values and back to Pointer? Are there conditions under which they are ignored (for example when called from a study, or while a Custom Study Control Bar button is enabled)? 3. If there is no supported method: is temporarily subclassing the chart window from a study safe, or are there known problems we should be aware of? Thank you very much for your help. Regards, Fabio. |
| [2026-09-29 16:39:50] |
| User719512 - Posts: 543 |
|
Maybe consider this design as an alternative to taking over left-button drag while Pointer/Hand is active. Instead of arming a custom study and dragging stop → entry yourself (which fights chart scroll under Pointer/Hand), lean on Sierra’s built-in Reward/Risk drawing tool for the geometry, then have a small ACSIL study turn that drawing into an order action. Flow 1. User draws a normal Reward/Risk chart drawing (stop / entry / target as usual). 2. User selects that drawing. 3. User right-clicks the chart and chooses a custom Chart Shortcut Menu item added by the study (e.g. “Execute Trade from Risk/Reward”). 4. On sc.MenuEventID, the study calls sc.GetSelectedUserDrawnDrawingFromChart(sc.ChartNumber, ChartDrawing). 5. If ChartDrawing.DrawingType == DRAWING_REWARD_RISK, read the levels from s_UseTool and build/send the trade (or for a POC, just AddMessageToLog them). Reward/Risk field mapping (ACSIL) • BeginValue → Stop • EndValue → Entry • ThirdValue → Target Side can be inferred from entry vs stop (entry above stop → long, below → short). Why this may be simpler for order entry • No need to suppress chart scrolling, switch tools to Chart Values, or subclass sc.ChartWindowHandle. • Uses documented APIs: AddACSChartShortcutMenuItem / RemoveACSChartShortcutMenuItem, MenuEventID, and GetSelectedUserDrawnDrawingFromChart. • The user still gets interactive stop/entry/target placement with Sierra’s own drawing tool (adjust handles, labels, R:R, etc.). • The study only runs the “execute” step when the menu item is chosen. Tradeoffs vs your drag-to-order UX • Not a single left-drag gesture under Pointer/Hand. • Requires an explicit select + right-click menu step. • Relies on Reward/Risk being the selected user drawing when the menu item is clicked. If the goal is “define stop/entry/target visually, then fire a sized order,” this path avoids the unsupported window-subclass workaround. If the goal is specifically “armed Control Bar button + left-drag while Pointer stays selected,” then you still need an answer to your original scroll/tool questions — this is just a different product shape that sidesteps that problem. |
| [2026-09-30 06:30:45] |
| Fabio - Posts: 155 |
|
Good morning and thank you for your answer. The Reward/Risk approach is a good idea, and I may add it later as a secondary, fall-back entry method. However, I would prefer not to use it as my main method, and here is why. My study works like this: after arming it with a Control Bar button (or its keyboard shortcut), - a single click places the stop, and a market order is sent immediately, sized from the stop distance; - a click and drag sets the stop where I press and the entry where I release, and a limit or stop order is sent automatically depending on where the entry is relative to the market. While the mouse moves, the study shows a live preview of the entry, stop and target lines together with the position size and dollar risk, so I see exactly what will be sent before I release. That is two actions per trade: arm, then click or drag. The Reward/Risk approach needs at least four (draw the tool, select it, right-click, choose the menu item). When trading a fast market at the right edge of the chart, those extra seconds matter. The only piece still missing is the drag: with Tools >> Pointer (or Hand) selected, Sierra Chart scrolls the chart while the left button is held down, so the price under the pointer does not change. At the moment I work around this by temporarily replacing the chart window procedure while the study is armed, but I would much prefer a supported method. My questions are: (1) Is there, or could you consider adding, a supported way for a study to stop the chart from scrolling during a left-button drag while the study is armed (for example while its Custom Study Control Bar button is enabled, or through a variable such as sc.BlockChartDrawingSelection)? This would let a study handle a drag the same way the built-in drawing tools do. (2) What is the intended use of sc.SetChartDrawingTool / sc.SetActiveDrawingTool, and why would they not change the active tool when called from a study? The first returns 1 and the second returns 0, and sc.CurrentlySelectedDrawingTool never changes. Switching to Tools >> Chart Values while armed, and back to Pointer afterwards, would also solve the problem. (3) Is temporarily replacing the chart window procedure (only while the study is armed, and restored on disarm, on full recalculation and on sc.LastCallToFunction) known to cause any problems, or is it acceptable at the user's own risk? Thank you again for your help. Best regards, Fabio |
| [2026-10-05 15:49:18] |
| Fabio - Posts: 155 |
|
Dear SC support, I hope this message finds you well. I read the 2962 release notes: sc.SetChartDrawingTool() was removed and sc.SetActiveDrawingTool() is now the recommended function. This is exactly what I need for my order-entry study: switch the chart to Tools >> Chart Values while the study is armed (so a left-button drag does not scroll the chart), then back to Tools >> Pointer after the order is sent. I am currently on 2957 (stable) and would like to know before updating: 1. In 2962, can a custom study call sc.SetActiveDrawingTool(sc.ChartNumber, DRAWING_TOOL_CHART_VALUES, 0) to make Chart Values the active tool, and later sc.SetActiveDrawingTool(sc.ChartNumber, DRAWING_TOOL_POINTER, 0) to return to Pointer? Are there any conditions, for example it cannot be called while a Custom Study Control Bar button is enabled, or only from a normal study update and not from a pointer/button event? 2. Which values does it expect? The DrawingTypeEnum constants are DRAWING_TOOL_POINTER = 10, DRAWING_TOOL_CHART_VALUES = 22, DRAWING_TOOL_HAND = 23, but sc.CurrentlySelectedDrawingTool reports Pointer = 0, Hand = 52, Chart Values = 2. 3. In 2957 this call returns 0 and the tool does not change. What does a return value of 0 mean? Thank you in advance for your reply. Fabio |
| [2026-10-05 19:55:39] |
| Sierra_Chart Engineering - Posts: 25432 |
|
1. In 2962, can a custom study call sc.SetActiveDrawingTool(sc.ChartNumber, DRAWING_TOOL_CHART_VALUES, 0) to make Chart Values the active tool, and later sc.SetActiveDrawingTool(sc.ChartNumber, DRAWING_TOOL_POINTER, 0) to return to Pointer? This was the intention of that function but we see that code is not enabled for the release build. We will do this in the next prerelease. Which should be out by tomorrow.Are there any conditions, for example it cannot be called while a Custom Study Control Bar button is enabled, or only from a normal study update and not from a pointer/button event? 2. Which values does it expect? The DrawingTypeEnum constants are DRAWING_TOOL_POINTER = 10, DRAWING_TOOL_CHART_VALUES = 22, DRAWING_TOOL_HAND = 23, Yes these are correct. but sc.CurrentlySelectedDrawingTool reports Pointer = 0, Hand = 52, Chart Values = 2. This variable only returns values, which are not documented but we will work on that.3. In 2957 this call returns 0 and the tool does not change. What does a return value of 0 mean? This will get fixed. The only reason for returning 0 is a chart that is not found or an invalid drawing type.
Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing Date Time Of Last Edit: 2026-10-05 19:56:39
|
| [2026-10-05 20:15:50] |
| Sierra_Chart Engineering - Posts: 25432 |
|
See the updated documentation here: ACSIL Interface Members - Variables and Arrays: sc.CurrentlySelectedDrawingTool Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing |
To post a message in this thread, you need to log in with your Sierra Chart account:
