DislikedA-Expert Advisor #1 - open trades with commands. Close the trade with command #2. Can B-Expert advisor keep trades open by ignoring trading company #2?Ignored
Inserted Code
//+------------------------------------------------------------------+ //| Expert advisor #1 - Open Trades with Command, Close with Command | //+------------------------------------------------------------------+ // Input parameters extern string CommandOpen = "OPEN"; // Command to open trades extern string CommandClose = "CLOSE"; // Command to close trades // Global variables bool ignoreCommandClose = false; // Flag to ignore command #2 from B-Expert Advisor //+------------------------------------------------------------------+ //| Expert advisor initialization function | //+------------------------------------------------------------------+ int init() { return(0); } //+------------------------------------------------------------------+ //| Expert advisor start function | //+------------------------------------------------------------------+ int start() { // Check for new trade commands if (IsTradeAllowed()) { if (IsCommand(CommandOpen)) { // Open new trade // ... } else if (IsCommand(CommandClose)) { if (!ignoreCommandClose) { // Close existing trades // ... } else { Print("Ignoring command to close trades"); } } } return(0); } //+------------------------------------------------------------------+ //| Function to check if trading is allowed | //+------------------------------------------------------------------+ bool IsTradeAllowed() { // Implement your own logic here to check if trading is allowed return(true); } //+------------------------------------------------------------------+ //| Function to check if a given command has been received | //+------------------------------------------------------------------+ bool IsCommand(string command) { bool result = false; // Check for command using your own implementation // ... return(result); } //+------------------------------------------------------------------+ //| Function to ignore command #2 from B-Expert Advisor | //+------------------------------------------------------------------+ void IgnoreCommandClose() { ignoreCommandClose = true; } //+------------------------------------------------------------------+ //| Function to stop ignoring command #2 from B-Expert Advisor | //+------------------------------------------------------------------+ void AllowCommandClose() { ignoreCommandClose = false; }