Login Page - Create Account

Support Board


Date/Time: Fri, 03 May 2024 05:21:56 +0000



Entering TickSize and Price Display Format using a Control Bar button or Keyboard shortcul

View Count: 1432

[2016-05-25 15:44:13]
SSS - Posts: 16
Hello.

Is it possible to program a Control Bar button or Keyboard shortcut to enter a pre-determined Tick Size and Price Display Format?
If so, I'd be grateful for a link to the documentation of how it's done.
[2016-05-25 17:17:10]
Sierra Chart Engineering - Posts: 104368
No, this is not supported.

But you could make an Advanced Custom Study do this:
http://www.sierrachart.com/index.php?page=doc/doc_MouseAndMenuInteractionFromACStudy.html

http://www.sierrachart.com/index.php?page=doc/doc_ACSIL_Members_Variables_And_Arrays.html#scTickSize
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: 2016-05-25 17:17:34
[2016-05-29 20:36:15]
SSS - Posts: 16
Thanks, very helpful as always.

Just a follow-up question. If I manually go to Chart Settings (F5), just above the Tick Size field there is Price Display Format.

I've managed to use sc.TickSize through ACSIL with no problems, but I could not find the variable to access Price Display Format anywhere in the list of ACSIL variables (http://www.sierrachart.com/index.php?page=doc/doc_ACSIL_Members_Variables_And_Arrays.html).

I've tried *most* of the likely variables but none seem to work, unless I missed the one that actually does.

sc.BaseGraphValueFormat sounds likely but it's a Read-only value and cannot be changed through ACSIL.
sc.ValueFormat, from its documentation, seems the most likely, but it didn't work.

Any ideas?
[2016-05-29 23:02:26]
Sierra Chart Engineering - Posts: 104368
This is the correct one:

sc.BaseGraphValueFormat sounds likely but it's a Read-only value and cannot be changed through ACSIL.

You will be able to set/change it in the next release.
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: 2016-05-29 23:02:36
[2016-05-30 12:52:59]
User365411 - Posts: 173
Hello.

Is it possible to program a Control Bar button or Keyboard shortcut to enter a pre-determined Tick Size and Price Display Format?
If so, I'd be grateful for a link to the documentation of how it's done.

Thanks SSS for making the request, it would also be useful for me.
May you post the code when it is available so I can add it to my menu?
Thank you
[2016-05-31 14:38:11]
SSS - Posts: 16
Sorry User365411, been in and out of hospital again. Here's what I came up with. In addition to loading this study on your chart, you'll need to put some of the reserved Buttons on one of the Control Bars.

For example, go to Window->Control Bars and select Control Bar 8 (in order not to disturb your existing toolbar setup). When the control bar appears, right-click on it and choose "Customize". From the window that opens, scroll down to the branch "Tools - Advanced Custom Study Buttons". Add at least buttons CS1, CS2, CS3, and CS4 because these are the ones called by the study.

Not that it matters, but it may be helpful to empty the control bar from any buttons already there first. I also set the control bar to Float and enlarged its window so I could have long-ish labels on the buttons.

I hope this helps.


SCSFExport scsf_ButtonExample(SCStudyInterfaceRef sc)
{
  //Study adapted from the code for the "Menu and Pointer Interaction Example" scsf_MenuAndPointerExample . NOTE: Study is NOT listed in the main Studies (F6) window.
  //It must be accessed through: Studies (F6) --> Add Custom Study --> Sierrachart Custom Studies & Examples --> Menu and Pointer Interaction Example
  //Source code is in "studies.cpp" file, function "scsf_MenuAndPointerExample" (starts at line 2697 in the studies.cpp that comes with SC v1414. Could be different in newer versions)

  float& initialTickSize = sc.GetPersistentFloat(1);
  initialTickSize = sc.TickSize;


  SCString MessageText;

  // Set configuration variables
  if (sc.SetDefaults)
  {
    sc.GraphName = "Button Example";

    sc.StudyDescription = "Working with Buttons placed on Control Bars (i.e. toolbars) to act as shortcuts";

    sc.GraphRegion = 0;

    //During development set this flag to 1, so the DLL can be modified. When development is completed, set it to 0 to improve performance.
    sc.FreeDLL = 1;

    // We have expressly set Autolooping to off because we are not filling
    // in any of the Subgraph[].Data[] arrays. Since Autolooping will
    // cause this function to be called for every bar in the chart and all
    // we are doing is using tools to do drawings, it would be inefficient
    // to use Autolooping.
    sc.AutoLoop = 0;

    // Indicate to receive the pointer events
    sc.ReceivePointerEvents = 0;

    sc.Input[10].Name = "My preset inputs";
    sc.Input[10].SetCustomInputStrings("option1; option2; thridOption;");
    sc.Input[10].SetCustomInputIndex(0);

    return;
  }

  if (sc.LastCallToFunction)
  {
    //When study is removed, this resets buttons in the toolbar to their original names (CS1, CS2, CS3, etc)
    sc.SetACSToolButtonText(1, "");
    sc.TickSize = initialTickSize;
    sc.SetACSToolButtonText(2, "");
    sc.SetACSToolButtonText(3, "");
    sc.SetACSToolButtonText(4, "");

    return;
  }


  if (sc.UpdateStartIndex == 0)
  {
    // Set the ACS Control Bar button 1 hover text
    sc.SetACSToolToolTip(1, "This is the custom hover text for ACS Control Bar button 1");

    // Set the ACS Control Bar button 1 text
    sc.SetACSToolButtonText(1, "ACS1");

    sc.SetACSToolButtonText(2, "Tick Size 100");
    sc.SetACSToolToolTip(2, "Hardwired change to Tick Size = 100");

    sc.SetACSToolButtonText(3, "TickSize 200"); //nothing appears on this button when we hover over it because no "tooltip" has been set

    sc.SetACSToolButtonText(4, "First Input Option");


  }


  // wait for an event
  if (sc.MenuEventID != 0)
  {
    if (sc.MenuEventID >= SC_ACS_TOOL1 && sc.MenuEventID <= SC_ACS_TOOL50)
    {
      MessageText.Format("Got event id %i, ", sc.MenuEventID);

      if (sc.PointerEventType == SC_ACS_TOOL_ON)
      {
        MessageText.Append("ACS Tool On Event, ");

        if (sc.MenuEventID == SC_ACS_TOOL2)
        {
          sc.TickSize = 100;
          sc.FlagToReloadChartData = 1; //reloads the chart
          //sc.ACSToolBlocksChartValuesTool(true);
          sc.SetACSToolEnable(SC_ACS_TOOL2, true); //This should make Button CS2 stick after being clicked. With button stuck, SC will continue monitoring events, and report them if sc.ReceivePointerEvents = 1 in the sc.SetDefaults block

        }
        if (sc.MenuEventID == SC_ACS_TOOL3)
        {
          sc.TickSize = 200;
          sc.FlagToReloadChartData = 1;
          sc.SetACSToolEnable(SC_ACS_TOOL3, false); //This should make Button CS3 NOT stick after being clicked.
                               //sc.ACSToolBlocksChartValuesTool(true);
        }

        if (sc.MenuEventID == SC_ACS_TOOL4)
        {
          sc.Input[10].SetCustomInputIndex(0); //assuming I have an input with preset selections, this should select the first present (index 0)
          sc.FlagToReloadChartData = 1;
          sc.SetACSToolEnable(SC_ACS_TOOL4, false);
        }
      }
      else if (sc.PointerEventType == SC_ACS_TOOL_OFF)
      {
        MessageText.Append("ACS Tool Off Event, ");

        if (sc.MenuEventID == SC_ACS_TOOL2)
          sc.ACSToolBlocksChartValuesTool(false);

        if (sc.MenuEventID == SC_ACS_TOOL2)
        {
          sc.TickSize = initialTickSize;
          sc.FlagToReloadChartData = 1;
        }
      }

      // reset tool 1. tool 1 will only get single down click
      if (sc.MenuEventID == SC_ACS_TOOL1)
        sc.SetACSToolEnable(SC_ACS_TOOL1, false);
    }

    // MessageText.Append("Y Value=");
    // MessageText += sc.FormatGraphValue(sc.ActiveToolYValue, sc.GetValueFormat());

    // MessageText.Append(", Bar Index=");
    // MessageText += sc.FormatGraphValue(sc.ActiveToolIndex, 0);

    sc.AddMessageToLog(MessageText, 0);
  }

}


[2016-06-02 20:03:02]
User365411 - Posts: 173
Thanks sss, greatly appreciated, next week I'll try to customize buttons and menu.
I wish you all the best for your problem!
Date Time Of Last Edit: 2016-06-02 20:03:50

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

Login

Login Page - Create Account