Login Page - Create Account

Support Board


Date/Time: Sun, 19 Jan 2025 03:22:26 +0000



Issue getting accurate sc.ActiveToolYValue value on right click

View Count: 770

[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);
    }
  }

[2018-03-21 04:58:09]
Sierra Chart Engineering - Posts: 104368
We think we know the reason. This probably is fixed. Update to the latest prerelease:
Software Download: Fast Update
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, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2018-03-21 07:44:09
[2018-03-21 15:40:33]
User474198 - Posts: 5
The update corrected the problem, thank you for the quick assistance.

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account