Login Page - Create Account

Support Board


Date/Time: Fri, 03 May 2024 01:25:34 +0000



Post From: Button menu toggle

[2021-01-28 06:18:48]
ertrader - Posts: 645
I was able to get close... there is a slight delay after clicking the button but not a big deal at all. Here is your code with study enable/disable, long enable/disable and short enable/disable. I used sc.FlagFullRecalculate = 1 to force a recalc after pushing the button. Maybe there is a better way but this does work.

You rock!!

  if (sc.IsFullRecalculation)//Is full recalculation
  {

    // set ACS Tool Control Bar tool tip
    sc.SetCustomStudyControlBarButtonHoverText(Input_ACSButtonNumber.GetInt(), "Trade CCI Enable/Disable");
    sc.SetCustomStudyControlBarButtonHoverText(Input_ACSButtonNumber1.GetInt(), "Trade Long");
    // set Custom Study Control Bar button text if the input to allow custom properties is not true. Otherwise, rely upon what the user sets.

    if (!Input_AllowCustomPropertiesForControlBarButton.GetYesNo())
     sc.SetCustomStudyControlBarButtonText(Input_ACSButtonNumber.GetInt(), "TCCI");
    if (!Input_AllowCustomPropertiesForControlBarButton1.GetYesNo())
     sc.SetCustomStudyControlBarButtonText(Input_ACSButtonNumber1.GetInt(), "Long");
    if (!Input_AllowCustomPropertiesForControlBarButton2.GetYesNo())
     sc.SetCustomStudyControlBarButtonText(Input_ACSButtonNumber2.GetInt(), "Short");   
    // set buttons to disabled i.e. not pushed in state
    sc.SetCustomStudyControlBarButtonEnable(Input_ACSButtonNumber.GetInt(), 0);
    sc.SetCustomStudyControlBarButtonEnable(Input_ACSButtonNumber1.GetInt(), 0);
    sc.SetCustomStudyControlBarButtonEnable(Input_ACSButtonNumber2.GetInt(), 0);     
    // set button color to show enabled / disabled state

    if (Enabled.GetYesNo())
     sc.SetCustomStudyControlBarButtonColor(Input_ACSButtonNumber.GetInt(), COLOR_GREEN);
    else
     sc.SetCustomStudyControlBarButtonColor(Input_ACSButtonNumber.GetInt(), COLOR_RED);
    if (Long.GetYesNo())
     sc.SetCustomStudyControlBarButtonColor(Input_ACSButtonNumber1.GetInt(), COLOR_GREEN);
    else
     sc.SetCustomStudyControlBarButtonColor(Input_ACSButtonNumber1.GetInt(), COLOR_RED);
    if (Short.GetYesNo())
     sc.SetCustomStudyControlBarButtonColor(Input_ACSButtonNumber2.GetInt(), COLOR_GREEN);
    else
     sc.SetCustomStudyControlBarButtonColor(Input_ACSButtonNumber2.GetInt(), COLOR_RED);   
  }
  if (sc.MenuEventID != 0)
  {
    if (sc.MenuEventID == Input_ACSButtonNumber.GetInt())
    {
     // reset button to disabled i.e. not pushed in state
     sc.SetCustomStudyControlBarButtonEnable(Input_ACSButtonNumber.GetInt(), 0);
     if (Enabled.GetYesNo())
     {
      // change state of input to disabled and set color accordingly
      Enabled.SetYesNo(0);
      sc.SetCustomStudyControlBarButtonColor(Input_ACSButtonNumber.GetInt(), COLOR_RED);
     }
     else
     {
      // change state of input to disabled and set color accordingly
      Enabled.SetYesNo(1);
      sc.SetCustomStudyControlBarButtonColor(Input_ACSButtonNumber.GetInt(), COLOR_GREEN);
     }
      sc.FlagFullRecalculate = 1;
    }
    else if (sc.MenuEventID == Input_ACSButtonNumber1.GetInt())
    {
      sc.SetCustomStudyControlBarButtonEnable(Input_ACSButtonNumber1.GetInt(), 0);
      if (Long.GetYesNo())
      {
        Long.SetYesNo(0);
        sc.SetCustomStudyControlBarButtonColor(Input_ACSButtonNumber1.GetInt(), COLOR_GREEN);
      }
      else
      {
        Long.SetYesNo(1);
        sc.SetCustomStudyControlBarButtonColor(Input_ACSButtonNumber1.GetInt(), COLOR_RED);
      }
      sc.FlagFullRecalculate = 1;
    }
    else if (sc.MenuEventID == Input_ACSButtonNumber2.GetInt())
    {
     sc.SetCustomStudyControlBarButtonEnable(Input_ACSButtonNumber2.GetInt(), 0);
     if (Short.GetYesNo())
     {
      Short.SetYesNo(0);
      sc.SetCustomStudyControlBarButtonColor(Input_ACSButtonNumber2.GetInt(), COLOR_GREEN);
     }
     else
     {
      Short.SetYesNo(1);
      sc.SetCustomStudyControlBarButtonColor(Input_ACSButtonNumber2.GetInt(), COLOR_RED);
     }
      sc.FlagFullRecalculate = 1;    
    }    
  }

Date Time Of Last Edit: 2021-01-29 12:47:22