Custom indicator and printing function to chart

 

Hi excellent people,

I am using this indicator (Kaufman MQ5) https://www.mql5.com/en/code/351

I tried this code to print the function to the chart but I only got

-1

-1

-1

0

do you know what I'm doing wrong? This would work in MT4...

Code is below and here is the chart and data window (which shows the indicator's value appropriately)


double handle1 = iCustom(NULL, PERIOD_CURRENT, "keff",8,0,0);

void PrintFunctionsToChart2()
{
    string temp = "Some Text\n";
    temp = temp + "------------------------------------------------\n"
    + "Some text " + DoubleToString(GetIndicator(handle1,0,0), NDigits) + "\n"
    + "Some text " + DoubleToString(GetIndicator(handle1,1,0), NDigits) + "\n"
    + "Some text " + DoubleToString(GetIndicator(handle1,2,0), NDigits) + "\n"
    + "Some text " + DoubleToString(0, NDigits) + "\n"
    + "------------------------------------------------\n";
    Comment(temp);
    
}
Kaufman Efficiency Ratio
Kaufman Efficiency Ratio
  • www.mql5.com
Kaufman Volatility Kaufman Volatility indicator according to Perry Kaufman book "Smarter Trading: Improving Performance in Changing Markets". DRAW_COLOR_CANDLES The DRAW_COLOR_CANDLES style (as DRAW_CANDLES) draws...
 

There is a difference between the "handle" and the actual indicator value. You are printing out the value of the handle.

Read the manual on how to use the handle to get access to the indicator data. It involves copying the indicator data to an array and then using the values in that array.

 
samuk1000 :


Read help: iCustom

Please note: in MQL5, the indicator handle is created once (in OnInit). Then, to obtain the values, use CopyBuffer

Documentation on MQL5: Technical Indicators / iCustom
Documentation on MQL5: Technical Indicators / iCustom
  • www.mql5.com
[in]  The name of the custom indicator, with path relative to the root directory of indicators (MQL5/Indicators/). If an indicator is located in a subdirectory, for example, in MQL5/Indicators/ [in] input-parameters of a custom indicator, separated by commas. Type and order of parameters must match. If there is no parameters specified, then...
Reason: