Support Board
Date/Time: Sun, 19 Jan 2025 06:38:12 +0000
Post From: Issue getting accurate sc.ActiveToolYValue value on right click
[2018-03-21 04:05:09] |
User474198 - Posts: 5 |
Hi, I have an issue where I am trying to right click on a specific price then select a menu button (placed in the menu by the custom study) that will feed the price to the custom study. The Y values I am getting from sc.ActiveToolYValue are not the prices i am clicking on (i have the hand tool selected). In the below code, the message log is printing a Y value that is consistently several points lower on the chart than where I clicked. On the NQ contract, the Y value is consistently 2.25 points lower than where i clicked, on YM contract the Y value is consistently 7 points lower, etc. The tick value in Chart Settings is correct, and the sc.ActiveToolIndex is returning the correct value. Why isn't this code returning the price that I right click on? Thanks for the assistance. // Section 2 - Do data processing here
int& menuButton = sc.GetPersistentInt(1); if(sc.Index == 0) { sc.Subgraph[0][sc.Index] = sc.Index; sc.PlaceACSChartShortcutMenuItemsAtTopOfMenu = true; sc.ReceivePointerEvents = ACS_RECEIVE_POINTER_EVENTS_ALWAYS; //Add Menu shortcuts if (menuButton <= 0) menuButton = sc.AddACSChartShortcutMenuItem(sc.ChartNumber, "Test_Y_Price"); if (menuButton < 0) sc.AddMessageToLog("Adding Menu Item failed", 1); return; } if (sc.LastCallToFunction) { sc.RemoveACSChartShortcutMenuItem(sc.ChartNumber, menuButton); return; } if(sc.MenuEventID != 0) { SCString y; if(sc.MenuEventID == menuButton) { y.Format("The Y value is: %f and the X value is: %d",sc.ActiveToolYValue,sc.ActiveToolIndex); sc.AddMessageToLog(y,0); } } |