Close orders by script

 

I'm trying to make a code to execute a script like this:

// Check the account equity and disable trading if needed

void CheckEquity()
{
    double equity = CalculateEquity();
    
    if (equity - initialEquity >= takeProfit || equity - initialEquity <= stopLoss)
    {
        tradingEnabled = false;
        Print("Trading has been disabled. \nAccount equity: ", equity);
        Comment("Trading has been disabled. \nAccount equity: ", equity);
        ExecuteCloseAllScript();
    }
    else
    {
        Comment("Trading is enabled. \nAccount equity: ", equity);
    }
}

// Run CloseAll script
void ExecuteCloseAllScript()
{
    string scriptName = "CloseAll.mq5";
    string scriptPath = TerminalInfoString(TERMINAL_DATA_PATH) + "\\" + scriptName;

    int executeResult = FileRun(scriptPath);
    if (executeResult == 1)
    {
        Print("CloseAll script executed successfully.");
    }
    else
    {
        Print("Failed to execute CloseAll script. Error code: ", executeResult);
    }
}

But I keep receiving the errros:

'FileRun' - undeclared identifier line 49

'scriptPath' - some operator expected line 49


Any help?

 
ChatGPT ?
Reason: