Support Board
Date/Time: Mon, 21 Apr 2025 05:46:40 +0000
Post From: Code optimization
[2025-02-06 20:51:37] |
User887126 - Posts: 85 |
please see below. my example trade logic is toward the end and i am still trying to figure out how to turn on/off each condition directly from ACS. My test algo has several conditions and i want to be able to turn on/off each of them and not consider it for placing new long order. sc.SetCustomStudyControlBarButtonHoverText(Input_ACSButtonNumber.GetInt(), "Algo Enable/Disable"); sc.SetCustomStudyControlBarButtonHoverText(Input_ACSButtonNumber1.GetInt(), "EMA SMA Cross long"); for (int Index = sc.UpdateStartIndex; Index < sc.ArraySize; Index++) if (!Input_AllowCustomPropertiesForControlBarButton.GetYesNo()) sc.SetCustomStudyControlBarButtonText(Input_ACSButtonNumber.GetInt(), "Algo"); if (!Input_AllowCustomPropertiesForControlBarButton1.GetYesNo()) sc.SetCustomStudyControlBarButtonText(Input_ACSButtonNumber1.GetInt(), "EMA SMA Long"); sc.SetCustomStudyControlBarButtonEnable(Input_ACSButtonNumber.GetInt(), 0); sc.SetCustomStudyControlBarButtonEnable(Input_ACSButtonNumber1.GetInt(), 0); 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 (sc.MenuEventID != 0) { if (sc.MenuEventID == Input_ACSButtonNumber.GetInt()) { 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(), RGB(0, 128, 255)); if (PositionData.PositionQuantity == 0 && PositionData.WorkingOrdersExist == 0 && (CurrentTime >= RTH1Start && Cond 1 == 1) //Create new order if all conditions are met . need to modify condition and connect with ACS s_SCNewOrder NewOrderL_EMASMA; |