Login Page - Create Account

Support Board


Date/Time: Fri, 22 Nov 2024 22:44:27 +0000



Post From: Button menu toggle

[2021-01-29 16:23:49]
ertrader - Posts: 672
I'm testing the following with no requirement for sc.IsFullRecalculation and this is working much better. It updates the buttons instantly with no delays! Also, added a button for enabling/disabling sending to trade service. So now, can switch on and off anything without going into the study.

    

// set ACS Tool Control Bar tool tip
    sc.SetCustomStudyControlBarButtonHoverText(Input_ACSButtonNumber.GetInt(), "Trade Study Enable/Disable");
    sc.SetCustomStudyControlBarButtonHoverText(Input_ACSButtonNumber1.GetInt(), "Trade Long");
    sc.SetCustomStudyControlBarButtonHoverText(Input_ACSButtonNumber2.GetInt(), "Trade Short");
    sc.SetCustomStudyControlBarButtonHoverText(Input_ACSButtonNumber3.GetInt(), "Send");
    // 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");   
    if (!Input_AllowCustomPropertiesForControlBarButton3.GetYesNo())
     sc.SetCustomStudyControlBarButtonText(Input_ACSButtonNumber3.GetInt(), "Send");   
    // 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);     
    sc.SetCustomStudyControlBarButtonEnable(Input_ACSButtonNumber3.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 (SendOrdersToService.GetYesNo())
     sc.SetCustomStudyControlBarButtonColor(Input_ACSButtonNumber3.GetInt(), COLOR_GREEN);
    else
     sc.SetCustomStudyControlBarButtonColor(Input_ACSButtonNumber3.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);
     }

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

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

    }  
    else if (sc.MenuEventID == Input_ACSButtonNumber3.GetInt())
    {
     sc.SetCustomStudyControlBarButtonEnable(Input_ACSButtonNumber3.GetInt(), 0);
     if (SendOrdersToService.GetYesNo())
     {
      SendOrdersToService.SetYesNo(0);
      sc.SetCustomStudyControlBarButtonColor(Input_ACSButtonNumber3.GetInt(), COLOR_GREEN);
     }
     else
     {
      SendOrdersToService.SetYesNo(1);
      sc.SetCustomStudyControlBarButtonColor(Input_ACSButtonNumber3.GetInt(), COLOR_RED);
     }
  
    }    
  }

Date Time Of Last Edit: 2021-02-04 23:21:56