Support Board
Date/Time: Sat, 23 Nov 2024 02:56:44 +0000
Post From: Code optimization
[2021-09-12 20:41:47] |
ForgivingComputers.com - Posts: 960 |
Buttons have extra overhead, because they interact with Windows itself. You don't need to set them up on every function call. Do all the one time button setup stuff like this: if (sc.IsFullRecalculation)
{ // set ACS Tool Control Bar tool tip sc.SetCustomStudyControlBarButtonHoverText(Input_ACSButtonNumber.GetInt(), "Trade Enable/Disable"); sc.SetCustomStudyControlBarButtonHoverText(Input_ACSButtonNumber1.GetInt(), "Long"); sc.SetCustomStudyControlBarButtonHoverText(Input_ACSButtonNumber2.GetInt(), "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(), "Trade"); 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(), RGB(0, 128, 255)); else sc.SetCustomStudyControlBarButtonColor(Input_ACSButtonNumber.GetInt(), COLOR_RED); if (Long.GetYesNo()) sc.SetCustomStudyControlBarButtonColor(Input_ACSButtonNumber1.GetInt(), RGB(0, 128, 255)); else sc.SetCustomStudyControlBarButtonColor(Input_ACSButtonNumber1.GetInt(), COLOR_RED); if (Short.GetYesNo()) sc.SetCustomStudyControlBarButtonColor(Input_ACSButtonNumber2.GetInt(), RGB(0, 128, 255)); else sc.SetCustomStudyControlBarButtonColor(Input_ACSButtonNumber2.GetInt(), COLOR_RED); if (SendOrdersToService.GetYesNo()) sc.SetCustomStudyControlBarButtonColor(Input_ACSButtonNumber3.GetInt(), RGB(0, 128, 255)); else sc.SetCustomStudyControlBarButtonColor(Input_ACSButtonNumber3.GetInt(), COLOR_RED); } |