Create EA with RSI Kernel Optimized indicator (iCustom)


To use the RSI Kernel Optimized indicator for EA, you can see the instructions below:

a. The buffers in the indicator and their indexes:

b. Required input parameters:

MT4 Version 1.15:


double getValueRSIKernelOptimized(string fSymbol,		//Symbol (fill _Symbol to use symbol current)
                                  ENUM_TIMEFRAMES Timeframe, 	//Timeframe (fill PERIOD_CURRENT to use current timeframe)
                                  int Index, 			//index buffer (see section a)
                                  int Shift 			//Shift (usually = 1 to get the previous bar value)
                                 )
  {
   string indicatorCustomName = "Market\RSI Kernel Optimized MT4 with Scanner";//Path indicator
   return iCustom(fSymbol, Timeframe, indicatorCustomName,
                  iMaxBarsBack,
                  "",
                  rsiLengthInput,
                  rsiSourceInput,
                  highPivotLen,
                  lowPivotLen,
                  "",
                  activationThresholdStr,
                  KDEKernel,
                  KDEBandwidth,
                  KDEStep,
                  false, false, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", false, false, false, false, false, false, "", "", false, "", 0, 0, "", false, 0, 0, false, 0, 0, "", 0, clrNONE, clrNONE, clrNONE, clrNONE, clrNONE, clrNONE, clrNONE, "", false, 0, 0, false, 0, 0, 0,
                  Index, Shift);
  }
    

MT5 Version 1.15 :

double getValueRSIKernelOptimized(string fSymbol,           	
                                  ENUM_TIMEFRAMES Timeframe,   	
                                  int Index,             	
                                  int Shift                	
                                 )
  {
   string indicatorCustomName = "Market\RSI Kernel Optimized with Scanner for MT5";
   int handle = iCustom(fSymbol, Timeframe, indicatorCustomName,
                        iMaxBarsBack,
                        "",
                        rsiLengthInput,
                        rsiSourceInput,
                        "",
                        highPivotLen,
                        lowPivotLen,
                        "",
                        activationThresholdStr,
                        KDEKernel,
                        KDEBandwidth,
                        KDEStep,
                        false,
                        false,
                        0, 0, 0, clrNONE, 0, clrNONE, 0, clrNONE, 0, clrNONE, "", false, false, false, false, false, false, "", "", false, "", 0, 0, "", false, 0, 0, false, 0, 0, "", 0, clrNONE, clrNONE, clrNONE, clrNONE, clrNONE, clrNONE, clrNONE, "", false, 0, 0, false, 0, 0, 0);
   if(handle < 0)
     {
      return(EMPTY_VALUE);
     }
   else
     {
      double buf[];
      switch(Index)
        {
         case 0:
            if(CopyBuffer(handle, 0, Shift, 1, buf) > 0)
               return(buf[0]);
            break;
         case 1:
            if(CopyBuffer(handle, 1, Shift, 1, buf) > 0)
               return(buf[0]);
            break;
         case 2:
            if(CopyBuffer(handle, 2, Shift, 1, buf) > 0)
               return(buf[0]);
            break;
         case 3:
            if(CopyBuffer(handle, 3, Shift, 1, buf) > 0)
               return(buf[0]);
            break;
         case 4:
            if(CopyBuffer(handle, 4, Shift, 1, buf) > 0)
               return(buf[0]);
            break;
         default:
            return EMPTY_VALUE;
            break;
        }
     }
   return EMPTY_VALUE;
  }

d. Use getValueRSIKernelOptimized function for EA

You use the getValueRSIKernelOptimized function to get the value needed to use for the EA.

To confirm that the buffer has a value, you need to compare it with EMPTY_VALUE.

Here are some examples to confirm that the previous bar buffers (shift = 1) have a value:

0 – Buy Signal (arrow)

bool buySignal = getValueRSIKernelOptimized(_Symbol, PERIOD_CURRENT, 0, 1) != EMPTY_VALUE;

1 – Sell Signal (arrow)

bool sellSignal = getValueRSIKernelOptimized(_Symbol, PERIOD_CURRENT, 1, 1) != EMPTY_VALUE;

2 – Bullish Dots

bool bullishDots = getValueRSIKernelOptimized(_Symbol, PERIOD_CURRENT, 2, 1) != EMPTY_VALUE;

3 – Bearish Dots

bool bearishDots = getValueRSIKernelOptimized(_Symbol, PERIOD_CURRENT, 3, 1) != EMPTY_VALUE;

Hopefully this article can help you more easily automate signals from the RSI Kernel Optimized indicator into EA.

You can download the indicator at:



Source link

Leave a Comment