Login Page - Create Account

Support Board


Date/Time: Wed, 15 Jan 2025 15:56:41 +0000



Post From: change grid scale settings by keyboard shortcut/chart shortcut/toolbar button?

[2017-08-07 15:50:44]
Sierra Chart Engineering - Posts: 104368
Here is the code to do what you want:
SCSFExport scsf_SelectScaleIncrementWithButtons(SCStudyInterfaceRef sc)
{
  if (sc.SetDefaults)
  {
    // Set the configuration and defaults

    sc.GraphName = "Select Scale Increment with Buttons";

    sc.StudyDescription = "This code serves as an example of how to set the base graph scale increment by using control bar buttons.";

    sc.AutoLoop = 0;

    sc.FreeDLL = 0;

    sc.Input[0].Name = "Scale Increment 1";
    sc.Input[0].SetFloat(1.0f);

    sc.Input[1].Name = "Scale Increment 2";
    sc.Input[1].SetFloat(2.0f);

    sc.Input[2].Name = "Scale Increment 3";
    sc.Input[2].SetFloat(4.0f);

    sc.Input[3].Name = "Scale Increment 4";
    sc.Input[3].SetFloat(8.0f);

    return;
  }



  if (sc.IsFullRecalculation)
  {
    sc.SetCustomStudyControlBarButtonHoverText(ACS_BUTTON_1, "Change to Scale Increment 1 Input");
    sc.SetCustomStudyControlBarButtonText(ACS_BUTTON_1, "Scale1");
    sc.SetCustomStudyControlBarButtonHoverText(ACS_BUTTON_2, "Change to Scale Increment 2 Input");
    sc.SetCustomStudyControlBarButtonText(ACS_BUTTON_2, "Scale2");
    sc.SetCustomStudyControlBarButtonHoverText(ACS_BUTTON_3, "Change to Scale Increment 3 Input");
    sc.SetCustomStudyControlBarButtonText(ACS_BUTTON_3, "Scale3");
    sc.SetCustomStudyControlBarButtonHoverText(ACS_BUTTON_4, "Change to Scale Increment 4 Input");
    sc.SetCustomStudyControlBarButtonText(ACS_BUTTON_4, "Scale4");
  }


  // wait for a button
  if (sc.MenuEventID >= ACS_BUTTON_1 && sc.MenuEventID <= ACS_BUTTON_4)
  {
    // reset button to off
    sc.SetCustomStudyControlBarButtonEnable(sc.MenuEventID, 0);
    sc.BaseGraphScaleIncrement = sc.Input[sc.MenuEventID - 1].GetFloat();
  }
}

This will be in the next release in Analysis >> Studies >> Add Custom Study >> Sierra Chart Custom Studies.

It will require you to Advanced Custom Study Buttons. Refer to:
Control Bar: Advanced Custom Study Control Bar Buttons
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