Login Page - Create Account

Support Board


Date/Time: Thu, 02 May 2024 16:30:33 +0000



Post From: Button menu toggle

[2024-01-21 23:31:29]
ertrader - Posts: 645
Here is an updated optimized version I am testing. So far, the optimization is working quite well reducing calculation times to 0 ms. We will see.

For my latest version, I am Enabling/Disabling trading and Enabling/Disabling sending to trading service. (not long, short or the other TCCI option)


1) Add the following prior to the SCDLLName call:

void SetButtonColor(SCStudyInterfaceRef& sc, int buttonNumber, int color)
{
sc.SetCustomStudyControlBarButtonColor(buttonNumber, color);
}


void HandleMenuEvent(SCStudyInterfaceRef& sc, SCInputRef& input, int eventID, int buttonNumber, int colorEnabled, int colorDisabled)
{
if (sc.MenuEventID == eventID)
{
sc.SetCustomStudyControlBarButtonEnable(buttonNumber, 0);
bool currentState = input.GetYesNo();
input.SetYesNo(!currentState);
SetButtonColor(sc, buttonNumber, currentState ? colorDisabled : colorEnabled);
}
}
2) Replace all the other menu code with:

if (sc.MenuEventID != 0)
{
HandleMenuEvent(sc, Enabled, Input_ACSButtonNumber.GetInt(), Input_ACSButtonNumber.GetInt(), COLOR_BABYBLUE, COLOR_RED);
HandleMenuEvent(sc, SendOrdersToService, Input_ACSButtonNumber1.GetInt(), Input_ACSButtonNumber1.GetInt(), COLOR_BABYBLUE, COLOR_RED);
}

Date Time Of Last Edit: 2024-01-21 23:47:05