Expert Problem

 

Hello everyone, I'm trying to make an expert with the CCFp for currency strength, the problem is that when i make the expert from thr indicator, it doesn't report the data so every variable in the code is equal to 0.

How can I solve it?

 
dominiK990628:

Hello everyone, I'm trying to make an expert with the CCFp for currency strength, the problem is that when i make the expert from thr indicator, it doesn't report the data so every variable in the code is equal to 0.

How can I solve it?

code? what code? without seeing any code nobody can help you 🤣

 
Seng Joo Thio:

code? what code? without seeing any code nobody can help you 🤣

This is the indicator code that i want to trasform in expert
Files:
CCFp.mq4  18 kb
 
  1. Why did you post your MT4 question in the Root / MT5 EA section instead of the MQL4 section, (bottom of the Root page?)
              General rules and best pratices of the Forum. - General - MQL5 programming forum
    Next time post in the correct place. The moderators will likely move this thread there soon.

  2.            double EURUSD_Fast = ma("EURUSD", Fast, MA_Method, Price, i);
    ⋮
               double GBPUSD_Fast = ma("GBPUSD", Fast, MA_Method, Price, i);
    
    If the naming pattern of your charts isn't exactly "BasQuo" then your code fails.
    Broker's use a variety of naming patterns: EURUSD, EURUSDc, EURUSDct, EURUSDi, EURUSDm, EURUSDecn, EURUSDpro, "EUR.USD", "EUR/USD", "EURUSD#", "EURUSD.", "EURUSD..", "EURUSD.c", "EURUSD.G", "EURUSD.SBe", "EURUSD.stp", "EURUSD+", "EURUSD-sb", etc.
    Don't hard code things; just use the predefined _Symbol, or add the adornments to predefined _Symbol via Input Variables, or calculate the adornments:
              SymbolName/Symbol. OrderSend - Symbols - MQL4 programming forum

  3. On MT4: Unless the current chart is that specific pair/TF referenced, you must handle 4066/4073 errors before accessing candle values.
              Download history in MQL4 EA - Forex Calendar - MQL4 programming forum - Page 3 #26 № 4

    The function linked to, opens a hidden chart for the symbol/TF in question (if not already open,) thus updating history, and temporarily placing the symbol on Market Watch (if not already there,) so SymbolInfoDouble(symbol, SYMBOL_BID) or MarketInfo(symbol, MODE_BID) don't also return zero on the first call.

 
dominiK990628:
This is the indicator code that i want to trasform in expert

I don't know what you meant by "make an expert with the CCFp" in your first post, and now "want to trasform in expert", but if you're talking about making iCustom() calls within an EA to retrieve the line values of this CCFp indicator, can refer to this example:

   double dC[8];
   string strCName[] = {"USD","EUR","GBP","CHF","JPY","AUD","CAD","NZD"};
   for (int i=0; i<8; i++)
   {
      dC[i] = iCustom(Symbol(),Period(),"CCFp",i,1);
      Print ("CCFp Buffer(",i,")(",strCName[i],") = ", dC[i]);
   }

which will give you this:

EURUSD,M15: CCFp Buffer(7)(NZD) = 0.002409766550842685
EURUSD,M15: CCFp Buffer(6)(CAD) = -0.0008166018027366828
EURUSD,M15: CCFp Buffer(5)(AUD) = 0.0008198192823217765
EURUSD,M15: CCFp Buffer(4)(JPY) = -0.0003591547320652699
EURUSD,M15: CCFp Buffer(3)(CHF) = -0.0009025469533718855
EURUSD,M15: CCFp Buffer(2)(GBP) = -0.00128618336821984
EURUSD,M15: CCFp Buffer(1)(EUR) = -0.0001766126058123652
EURUSD,M15: CCFp Buffer(0)(USD) = 0.0003127475517836764