Failed to create EMA handle for 0

 

I have created a Ea with EMA and ADX. However while adding EA to the Forex pair chart, it was showing up the below error. Could you help me in resolving this issue.

While compiling the EA, it showed 0 errors

ema_adx_alert (NZDUSD,M1) ❌ Failed to create EMA handle for 0

Attached the file for reference.

NZDUSD - New Zealand Dollar vs US Dollar - Today's currency exchange rates — Forex exchange rates
NZDUSD - New Zealand Dollar vs US Dollar - Today's currency exchange rates — Forex exchange rates
  • 2025.03.21
  • www.mql5.com
NZDUSD - New Zealand Dollar vs US Dollar - Most popular currency pair charts. Use the filter below to select the exchange rates you need. Each chart features Bid/Ask prices, as well as daily growth.
Files:
mql5.mq5  5 kb
 
Jaya chandra:

I have created a Ea with EMA and ADX. However while adding EA to the Forex pair chart, it was showing up the below error. Could you help me in resolving this issue.

While compiling the EA, it showed 0 errors

ema_adx_alert (NZDUSD,M1) ❌ Failed to create EMA handle for 0

Create the handle after initialization

 
Lorentzos Roussos #:

Create the handle after initialization

Hi, I have attached the code, I have very little knowledge on coding, what exactly needs to be done for "Create the handle after initialization"

 
attach the mq5 file , we cant see it
 

String Replace returns how many characters it replaced not the new string 

the string is still in pairs[i]

string tempSymbol = StringReplace(pairs[i], " ", ""); // ✅ Fix StringTrim issue
 
Lorentzos Roussos #:
attach the mq5 file , we cant see it
Attached the mql5 file 
 
Lorentzos Roussos #:

String Replace returns how many characters it replaced not the new string 

the string is still in pairs[i]

changed as below, still getting the same error

string tempSymbol = pairs[i];

StringReplace(tempSymbol, " ", ""); 


 
Jaya chandra #:

changed as below, still getting the same error

string tempSymbol = pairs[i];

StringReplace(tempSymbol, " ", ""); 


do you have all the symbols that are in pairs list in the market watch ?

 
Lorentzos Roussos #:

do you have all the symbols that are in pairs list in the market watch ?

Those all are available in the account, but all the pairs are not present in marketwatch
 
Jaya chandra #:
Those all are available in the account, but all the pairs are not present in marketwatch

try this

        string tempSymbol = StringReplace(pairs[i], " ", ""); // ✅ Fix StringTrim issue
        if(SymbolSelect(pairs[i],true)){
        CheckRetracement(pairs[i], PERIOD_M5, "M5");  // 5 Min Timeframe
        CheckRetracement(pairs[i], PERIOD_M1, "M1");  // 1 Min Timeframe
        }

although its not the optimal way to approach this

 
Lorentzos Roussos #:
string tempSymbol = StringReplace(pairs[i], " ", ""); // ✅ Fix StringTrim issue         if(SymbolSelect(pairs[i],true)){         CheckRetracement(pairs[i], PERIOD_M5, "M5");  // 5 Min Timeframe         CheckRetracement(pairs[i], PERIOD_M1, "M1");  // 1 Min Timeframe         }
(NZDUSD,M1) ⚠️ Not enough data for AUDJPY on M1