Ea function problem, chat gpt fail

 
In the following function the ibandsonarray always returns 0. I have verified the array is filled with the correct values, but I always get 0 for the upper and lower bands. I searched this forum, google, and youtube for several hours, and found some people who had this problem, but they either didn't set array as series or didn't size the array correctly. I even used chat gpt and eventually it told me to ask an expert. How do I get the correct values for the ibandsonarray functions in the following code?
int obv()
  {
   int obv =0;
   double obvbb[];
   double obvbblower1, obvbblower2, obvbbupper1, obvbbupper2;
   ArrayResize(obvbb,obvbblen,0);
   ArraySetAsSeries(obvbb,true);

   for(int i=0; i<obvbblen; i++)
     {
      obvbb[i]=iOBV(_Symbol,slow,obvsrc,i);
     }
   obvbbupper1 = iBandsOnArray(obvbb,0,obvbblen,obvbbstdev,0,1,1);
   obvbbupper2 = iBandsOnArray(obvbb,0,obvbblen,obvbbstdev,0,1,2);
   obvbblower1 = iBandsOnArray(obvbb,0,obvbblen,obvbbstdev,0,2,1);
   obvbblower2 = iBandsOnArray(obvbb,0,obvbblen,obvbbstdev,0,2,2);

     {
      if(obvbb[2] < obvbblower2 && obvbb[1] > obvbblower1)
         obv = -1;
     }
     {
      if(obvbb[1] > obvbbupper2 && obvbb[2] < obvbbupper1)
         obv = 1;
     }

   //Print("obvbbupper1 lower is"," ",  DoubleToString(obvbbupper1,16));
   return(obv);
  }
 
M W I even used chat gpt a

Stop using ChatGPT.
          Help needed to debug and fix an AI EA - Trading Systems - MQL5 programming forum #2 (2023)

ChatGPT (the worst), “Bots Builder”, “EA builder”, “EA Builder Pro”, EATree, “Etasoft forex generator”, “Forex Strategy Builder”, ForexEAdvisor (aka. ForexEAdvisor STRATEGY BUILDER, and Online Forex Expert Advisor Generator), ForexRobotAcademy.com, forexsb, “FX EA Builder”, fxDreema, Forex Generator, FxPro, “LP-MOBI”, Molanis, “Octa-FX Meta Editor”, Strategy Builder FX, “Strategy Quant”, “Visual Trader Studio”, “MQL5 Wizard”, etc., are all the same. You will get something quick, but then you will spend a much longer time trying to get it right, than if you learned the language up front, and then just wrote it.

Since you haven't learned MQL4/5, therefor there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into yours.

We are willing to HELP you when you post your attempt (using Code button) and state the nature of your problem, but we are not going to debug your hundreds of lines of code. You are essentially going to be on your own.

ChatGPT
  1. Even it says do not use it for coding. * 
  2. Mixing MT4 and MT5 code together.
  3. Creating multiple OnCalculate/OnTick functions.
  4. OnCalculate returning a double.
  5. Filling buffers with zero in OnInit (they have no size yet). Setting buffer elements to zero but not setting Empty Value to correspond.
  6. Calling undefined functions.
  7. Calling MT4 functions in MT5 code.
  8. Sometimes, not using strict (MT4 code).
  9. Code that will not compile.
  10. Creating code outside of functions. * 
  11. Creating incomplete code. * 
  12. Initialization of Global variables with non-constants. * 
  13. Assigning a MT5 handle to a double or missing the buffer and bar indexes in a MT4 call. * 
  14. Useing MT4 Trade Functions without first selecting an order. * 
  15. Uses NULL in OrderSend. * 
bot builder Creating two OnInit() functions. * 
EA builder
  1. Counting up while closing multiple orders.
  2. Not useing time in new bar detection.
  3. Not adjusting for 4/5 digit brokers, TP/SL and slippage. * 
  4. Not checking return codes.
EATree Uses objects on chart to save values — not persistent storage (files or GV+Flush.) No recovery (crash/power failure.)
ForexEAdvisor
  1. Non-updateing global variables.
  2. Compilation errors.
  3. Not checking return codes.
  4. Not reporting errors.
FX EA Builder
  1. Not checking return codes.
  2. Loosing open tickets on terminal restart. No recovery (crash/power failure.)
  3. Not adjusting stops for the spread. * 
  4. Using OrdersTotal directly.
  5. Using the old event handlers.
 
In case this response was from an actual human, no I did not use chat gpt to generate my function. I used it in an attempt to debug code I wrote by myself. Did you even read the OP? I clearly stated my problem and posted my code. 
 
William Roeder # :

Deja de usar ChatGPT. Se necesita ayuda para depurar y reparar un EA con IA - Trading Systems - Foro de programación MQL5 n.º 2 (20 23 )
          

ChatGPT (el peor ), “Bots Builder”, “EA builder”, “EA Builder Pro”, EATree, “Etasoft forex generador”, “Forex Strategy Builder”, ForexEAdvisor (también conocido como ForexEAdvisor STRATEGY BUILDER y Online Forex Expert Advisor Generator ), ForexRobotAcademy.com, forexsb , “FX EA Builder”, fxDreema , Forex Generator, FxPro, “ LP-MOBI ”, Molanis , “Octa-FX Meta Editor”, Strategy Builder FX , “Strategy Quant”, “Visual Trader Studio ”, “ Asistente MQL5 ”, etc., son todos iguales. Obtendrás algo rápido , pero luego pasarás mucho más tiempo intentando hacerlo bien que si aprendieras el idioma desde el principio y luego simplemente lo escribieras.

Como no ha aprendido MQL4/5, no existe un lenguaje común para comunicarnos. Si le decimos lo que necesita, no podrá codificarlo. Si te damos el código es que no sabes cómo integrarlo en el tuyo.

Estamos dispuestos a AYUDARLO cuando publique su intento (usando el botón Código ) e indique la naturaleza de su problema, pero no vamos a depurar sus cientos de líneas de código. Básicamente, estarás solo.

ChatGPT
  1. Incluso dice que no lo uso para codificar.  * 
  2. Mezclando códigos MT4 y MT5.
  3. Creando múltiples funciones OnCalculate/OnTick .
  4. OnCalculate devuelve un doble .
  5. Llenando buffers con cero en OnInit (aún no tienen tamaño). Establecer los elementos del búfer en cero pero no establecer el valor vacío para que corresponda.
  6. Llamar a funciones indefinidas.
  7. Llamar a funciones MT4 en código MT5.
  8. A veces, no se utiliza estricto (código MT4).
  9. Código que no se compilará.
  10. Crear código fuera de funciones.  * 
  11. Creando código incompleto.  * 
  12. Inicialización de variables globales con no constantes.  * 
  13. Asignar un identificador MT5 a un doble o faltar los índices de búfer y barra en una llamada MT4.  * 
  14. Usar las funciones comerciales de MT4 sin seleccionar primero un orden.  * 
  15. Utiliza NULL en OrderSend.  * 
constructor de robots Creando dos funciones OnInit().  * 
constructor de EA
  1. Contando mientras se cierran múltiples pedidos.
  2. No utilizar el tiempo en la detección de nuevas barras.
  3. Sin ajustar por corredores de 4/5 dígitos, TP/SL y gradual.  * 
  4. No compruebe los códigos de retorno.
comerárbol Utilice objetos en el gráfico para guardar valores, sin almacenamiento persistente ( archivos o GV + Flush ). Sin recuperación (caída/fallo de energía).
ForexEAdvisor
  1. Variables globales no actualizables.
  2. Errores de compilación.
  3. No compruebe los códigos de retorno.
  4. No reportar errores.
Constructor FX EA
  1. No compruebe los códigos de retorno.
  2. Perder tickets abiertos al reiniciar la terminal. Sin recuperación (caída/fallo de alimentación).
  3. No ajustar las paradas para el diferencial.  * 
  4. Usando OrdersTotal directamente .
  5. Usando los controladores de eventos antiguos.
Please:
1. If you do not know an answer, do not post.
2. If you know the answer but do not intend to share it, please do not post.
3. Do not use sarcasm or irony in the "Answers" you give. We are not to blame for your problems
 

iXXXOnArray functions do not work correctly in MT4. This is known and confirmed (I saw a discussion of this on the forum, but I don't have a link). The terminal developers will not fix a bug with these functions for MT4, since MT4 is no longer being developed.

Calculate Bands values yourself instead of using high-level functions that don't work correctly.

 
Diego Esquivia #:
1. If you do not know an answer, do not post.
2. If you know the answer but do not intend to share it, please do not post.
3. Do not use sarcasm or irony in the "Answers" you give. We are not to blame for your problems
I have no problems. This is twice, you posted without knowing the answer. Live in ignorance snowflake, on my Do Not Help list.