RSI + BB + EMA
It seems you are relying on ChatGPT. Don't!
Instead, reference the documentation or the book.
Indicator functions return a handle, not the buffer data. You do in fact declare handles, but then don't assign me. A clear sign that you are using ChatGPT for the skeleton code.
// Indicator handles for RSI and MA int RSI_Handle, MA_Handle;
Please read the documentation for iRSI() and the CopyBuffer() function to retrieve the buffer values.
- www.mql5.com
Hi
In mql5 the functions for indicators like iRSI, iMA etc, return only handle for the indicator values. You should initialize those handles in the OnInit function and then use CopyBuffer to get the data from chosen index. So move iRSI to the OnInit and in the OnCalculate use this instead:
RSI_Buffer[i]=getRSI(i); double getRSI(int i){ double res[]; ResetLastError(); if(CopyBuffer(RSI_Handle, 0, i,1,res)<0 ){ Print("Error copying RSI data for buffer - error:"+IntegerToString(GetLastError())+"!!"); return(0); } return(norm(res[0])); }
Have a nice day👍📊
I took my own crack at coding today. This is supposed to be an indicator that connects BB and an EMA to the RSI indicator data that will be displayed in one indicator window.
However, after fixing all of the errors Meta Editor has given me, the indicator window shows up blank on my chart.
When I look at the data window, the value just shows 10.000000000.
What seems to be the problem? is it just crap code or what?