Guys, please i need help with this MT4 error message: 'SYMBOL_TRADE_ALLOWED' - undeclared identifier
The code is below;
// Function to start multi-pair trading
void StartMultiPairTrading() {
// Split the SymbolsToTrade string into an array
string symbolArray[];
int totalSymbols = StringSplit(SymbolsToTrade, ',', symbolArray);
// Loop through each symbol in the array
for (int i = 0; i < totalSymbols; i++) {
// Check if the symbol is in the Market Watch AND trading is allowed
// (Checking for SYMBOL_TRADE_MODE is essential)
if (SymbolInfoInteger(symbolArray[i], SYMBOL_TRADE_ALLOWED) == 1 && SymbolInfoInteger(symbolArray[i], SYMBOL_TRADE_MODE) == 1) {
// Do something with the symbol
// Example: Print the symbol name to the log
Print("Trading symbol: ", symbolArray[i]);
// Calculate indicators for the current symbol
CalculateIndicators(symbolArray[i]);
// Manage trades for the current symbol
ManageTrades(symbolArray[i]);
} else {
// The symbol is not in the Market Watch or trading is not allowed
Print("Symbol not found in Market Watch or trading is not allowed: ", symbolArray[i]);
}
}
}
The code is below;
// Function to start multi-pair trading
void StartMultiPairTrading() {
// Split the SymbolsToTrade string into an array
string symbolArray[];
int totalSymbols = StringSplit(SymbolsToTrade, ',', symbolArray);
// Loop through each symbol in the array
for (int i = 0; i < totalSymbols; i++) {
// Check if the symbol is in the Market Watch AND trading is allowed
// (Checking for SYMBOL_TRADE_MODE is essential)
if (SymbolInfoInteger(symbolArray[i], SYMBOL_TRADE_ALLOWED) == 1 && SymbolInfoInteger(symbolArray[i], SYMBOL_TRADE_MODE) == 1) {
// Do something with the symbol
// Example: Print the symbol name to the log
Print("Trading symbol: ", symbolArray[i]);
// Calculate indicators for the current symbol
CalculateIndicators(symbolArray[i]);
// Manage trades for the current symbol
ManageTrades(symbolArray[i]);
} else {
// The symbol is not in the Market Watch or trading is not allowed
Print("Symbol not found in Market Watch or trading is not allowed: ", symbolArray[i]);
}
}
}
If it works for you, don't forget to help others.