HELP!I am beginner,create ea based on a indicator

 

    Indicator name: My_Indicator.

    iCustom buffers: 

    Buffer_7=Buy_Signal, Buffer_8=Sell_signal, Buffer_9= SL_Price, Buffer_10= TP1_Price, Buffer_11= TP2_Price, Buffer_12= TP3_Price.

int OnInit()
  {
   MY_handle=iCustom(NULL,0,"My_Indicator");
   
   if(MY_handle==INVALID_HANDLE)
     {
      PrintFormat("Failed to generate My_Indicator handle. Error code %d",
                  GetLastError());
      return (INIT_FAILED);
     }
    return(INIT_SUCCEEDED);
   }
void OnTick()
  {
   
   double buffer_7[],buffer_8[],buffer_9[],buffer_10[],buffer_11[],buffer_12[];  
   CopyBuffer(MY_handle,7,0,1,buffer_7);
   CopyBuffer(MY_handle,8,0,1,buffer_8);
   CopyBuffer(MY_handle,9,0,1,buffer_9);
   CopyBuffer(MY_handle,10,0,1,buffer_10);
   CopyBuffer(MY_handle,11,0,1,buffer_11);
   CopyBuffer(MY_handle,12,0,1,buffer_12);

   printf(buffer_7[0]);
   printf(buffer_8[0]);
   printf(buffer_9[0]);
   printf(buffer_10[0]);
   printf(buffer_11[0]);
   printf(buffer_12[0]);
   
  }

    buffer_7[0],buffer_8[0],buffer_9[0],buffer_10[0],buffer_11[0],buffer_12[0]--Unable to get data--Buy_Signal,Sell_signal,SL_Price, TP1_Price, TP2_Price, TP3_Price

    I can't find the reason!

Files:
8.png  5 kb
 

You need to look into the CopyBuffer help

Call by the first position and the number of required elements

int  CopyBuffer(
   int       indicator_handle,     // indicator handle
   int       buffer_num,           // indicator buffer number
   int       start_pos,            // start position
   int       count,                // amount to copy
   double    buffer[]              // target array to copy
   );

Read the description especially carefully:

buffer_num

[in]  The indicator buffer number.

Documentation on MQL5: Timeseries and Indicators Access / CopyBuffer
Documentation on MQL5: Timeseries and Indicators Access / CopyBuffer
  • www.mql5.com
CopyBuffer - Timeseries and Indicators Access - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
弗拉基米尔·卡尔普托夫 #:

您需要查看 CopyBuffer 帮助

按第一个位置和所需元素的数量调用

特别仔细阅读说明:

缓冲区编号

[in] 指标缓冲区编号

My mistake has changed now. But it's still the same
 
alasijiagogogo # :
My mistake has changed now. But it's still the same

In words, no one here believes. Show your MQL5 code - show your corrected code.

Reason: