Login Page - Create Account

Support Board


Date/Time: Fri, 31 Jan 2025 13:48:17 +0000



Post From: ControlBarButton and TradeWindowConfigFileName

[2019-05-02 02:00:38]
ZenAlchemist - Posts: 23
Below is some ACSIL to change the trade window configuration based on a control bar button click. My idea is to use several of these studies at once, each setup for a different trade config file.

My issue is that if I click the control bar button to change the config, which does work, and then manually switch to a different config file in the trade window, it gets changed back to the config file set in the study. When this happens, the message I have set to show in the message log does NOT show in the log. The config simply keeps switching back to that set in the study and the manually selected one does not remain selected. (I think the change from the manually selected file to the one set from the study happens on the next data event/tick)


SCSFExport scsf_TradeWindowConfiguration (SCStudyInterfaceRef sc) {
SCInputRef inTradeConfigFileName = sc.Input[1];
SCInputRef inACSButtonNumber = sc.Input[2];
SCInputRef inACSButtonText = sc.Input[3];

if (sc.SetDefaults) {
sc.GraphName = "Trade Window Configurationn Selection";
sc.StudyDescription = "";
sc.GraphRegion = 0;
sc.AutoLoop = 0;
sc.ReceivePointerEvents = ACS_RECEIVE_POINTER_EVENTS_WHEN_ACS_BUTTON_ENABLED;
sc.DisplayStudyName = 0;
sc.DisplayStudyInputValues = 0;

inTradeConfigFileName.Name = "Trade Window Config FileName";
inTradeConfigFileName.SetString("NQ.twconfig");

inACSButtonNumber.Name = "ACS Button Number";
inACSButtonNumber.SetInt(1);

inACSButtonText.Name = "ACS Button Text";
inACSButtonText.SetString("T1");

return;
}

if (sc.LastCallToFunction) {
sc.SetCustomStudyControlBarButtonHoverText(inACSButtonNumber.GetInt(), "");
sc.SetCustomStudyControlBarButtonText(inACSButtonNumber.GetInt(), "");
return;
}

if (sc.UpdateStartIndex == 0) {
sc.SetCustomStudyControlBarButtonText(inACSButtonNumber.GetInt(), inACSButtonText.GetString());
}

if (sc.MenuEventID != 0 && sc.MenuEventID == inACSButtonNumber.GetInt()) {
if (sc.PointerEventType == SC_ACS_BUTTON_ON) {
sc.TradeWindowConfigFileName = inTradeConfigFileName.GetString();
sc.SetCustomStudyControlBarButtonEnable(inACSButtonNumber.GetInt(), false);

SCString MessageText;
MessageText.AppendFormat("Trade Config file changed to %s", inTradeConfigFileName.GetString());
sc.AddMessageToLog(MessageText,1);
}
}
}