Download MetaTrader 5

iCustom 1st time error

To add comments, please log in or register
Make screenshots in MetaTrader and manage them in the gallery!
Marcelo Coutinho
1151
Marcelo Coutinho 2014.05.26 17:49 

Hi there !

I am trying to add iCustom to my EA @ OnInit() part.

I have realized that he problem is @ the iCustom definition.

Here is the code ...

   if(tipo_de_indicador==YTRD_INDITYPE_JMA)
     {
      iJMA_fast_handle=iCustom(my_symbol,my_timeframe,"JMA",7,100,PRICE_CLOSE,0,0);
      iJMA_slow_handle=iCustom(my_symbol,my_timeframe,"JMA",9,100,PRICE_CLOSE,0,0);

      if(iJMA_fast_handle==INVALID_HANDLE)
        {
         Print("Failed to get the indicator iJMA_fast_handle");
         return(-1);
        }

      if(iJMA_slow_handle==INVALID_HANDLE)
        {
         Print("Failed to get the indicator iJMA_slow_handle");
         return(-1);
        }

      ChartIndicatorAdd(ChartID(),0,iJMA_fast_handle);
      ChartIndicatorAdd(ChartID(),0,iJMA_slow_handle);

      ArraySetAsSeries(iJMA_buf_fast,true);
      ArraySetAsSeries(iJMA_buf_slow,true);
     }
   else
     {
      return(INIT_PARAMETERS_INCORRECT);
     }

 Here us the JMA definition ...

enum Applied_price_      //Type of constant
  {
   PRICE_CLOSE_ = 1,     //PRICE_CLOSE
   PRICE_OPEN_,          //PRICE_OPEN
   PRICE_HIGH_,          //PRICE_HIGH
   PRICE_LOW_,           //PRICE_LOW
   PRICE_MEDIAN_,        //PRICE_MEDIAN
   PRICE_TYPICAL_,       //PRICE_TYPICAL
   PRICE_WEIGHTED_,      //PRICE_WEIGHTED
   PRICE_SIMPL_,         //PRICE_SIMPL_
   PRICE_QUARTER_,       //PRICE_QUARTER_
   PRICE_TRENDFOLLOW0_,  //PRICE_TRENDFOLLOW0_
   PRICE_TRENDFOLLOW1_   //PRICE_TRENDFOLLOW1_
  };
input int JMALength_=7;  //Depth of smoothing                   
input int JMAPhase_=100; //Smoothing parameter
                         //that changes within the range -100 ... +100,
                         //impacts the transitional process quality;
input Applied_price_ IPC=PRICE_CLOSE_;//Price constant
/* used for calculation of the indicator (1-CLOSE, 2-OPEN, 3-HIGH, 4-LOW, 
  5-MEDIAN, 6-TYPICAL, 7-WEIGHTED, 8-SIMPLE, 9-QUARTER, 10-TRENDFOLLOW, 11-0.5 * TRENDFOLLOW.) */
input int JMAShift=0;      //Horizontal shift of the indicator in bars
input int JMAPriceShift=0; //Vertical shift of the indicator in points

 Please accept my apologies but I really cannot find the issue.

Regards,

MRC 

Alain Verleyen
Moderator
30640
Alain Verleyen 2014.05.26 23:58  
YouTrade:

Hi there !

I am trying to add iCustom to my EA @ OnInit() part.

I have realized that he problem is @ the iCustom definition.

Here is the code ...

 Here us the JMA definition ...

 Please accept my apologies but I really cannot find the issue.

Regards,

MRC 

Which error did you get ? Printing a message like "Failed...." is not enough, you need to print the error code.
Marcelo Coutinho
1151
Marcelo Coutinho 2014.05.27 00:06  
angevoyageur:
Which error did you get ? Printing a message like "Failed...." is not enough, you need to print the error code.

There is no error code. Just the Initialization failed I posted before that y said to check the On Init() :)

It does not say where and that was the reason I posted this one more specific. 

Alain Verleyen
Moderator
30640
Alain Verleyen 2014.05.27 00:10  
YouTrade:

There is no error code. Just the Initialization failed I posted before that y said to check the On Init() :)

It does not say where and that was the reason I posted this one more specific. 

It doesn't print this message ?

Print("Failed to get the indicator iJMA_fast_handle");

If not you have to post all you OnInit() otherwise I can't help.

Marcelo Coutinho
1151
Marcelo Coutinho 2014.05.27 00:19  
angevoyageur:

It doesn't print this message ?

If not you have to post all you OnInit() otherwise I can't help.

No ... it does not ... It fails during compilation.

I will get my OnInit() and posi it fo you.

Tks 

Hector Pacheco
14733
Hector Pacheco 2014.05.28 06:01  
YouTrade :

No ... it does not ... It fails during compilation.

I will get my OnInit() and posi it fo you.

Tks 

What is the error message in the compiler?
Marcelo Coutinho
1151
Marcelo Coutinho 2014.05.28 16:36  
Iwori_Fx:
What is the error message in the compiler?

Initialization Failed ... just that ! 

Anyway ... I I have found the problem because the code itseft was easy.

Question Please: Is there any more detailed log in MT5 Client to get more information of just the one @ Journal Tab ? 

Alain Verleyen
Moderator
30640
Alain Verleyen 2014.05.28 17:03  
YouTrade:

Initialization Failed ... just that ! 

Anyway ... I I have found the problem because the code itseft was easy.

Question Please: Is there any more detailed log in MT5 Client to get more information of just the one @ Journal Tab ? 

What was the problem ?
Marcelo Coutinho
1151
Marcelo Coutinho 2014.05.28 18:49  
angevoyageur:
What was the problem ?
The syntax of iCustom was wrong. I am still working on to figure out how to place an external indicator.
To add comments, please log in or register