Download MetaTrader 5

iCustom with ENUM_TIMEFRAMES

To add comments, please log in or register
BurkhardWille
176
BurkhardWille  

Hi,

I am already trying to read the values of an indicator with iCustom, but always I get only 0 with this kind of indicator:


test.mq4


extern ENUM_TIMEFRAMES   MA_TF            = PERIOD_M30;

extern int               MA_Period        = 50;

extern ENUM_MA_METHOD    MA_method        = MODE_SMA;

test[i] = iCustom(Symbol(), NULL, "test", PERIOD_M30, 50, MODE_SMA, 0, 0); 



If I delete the "extern" from the indicator I can read the value from the indicator with the iCustom-function correctly.


test[i] = iCustom(Symbol(), NULL, "test", 0, 0);  


Maybe there is a trick?

Carl Schreiber
7354
Carl Schreiber  
1) Please edit your post and put your coed in the source-box (use the SRC-button)!

2) Put your cursor above iCustom and press F1 and amend the example from there: double val=iCustom(NULL,0,"SampleInd",13,1,0); // NULL ^= _Symbol ans 0 ^= _Period!!

3) Instead of using
PERIOD_M30, 50, MODE_SMA as arguments for the indi.call use the variable you defined: MA_TF and and and place them where they have to be acc. to the sequence of the extern/input avriables.

4) Missing arguments are 'replaced' by the default values of the indi.

5) The last two arguments are mode and shift - between the name and these two are the arguments for iCustom - read the help!
whroeder1
16058
whroeder1  
BurkhardWille: I am already trying to read the values of an indicator with iCustom, but always I get only 0 with this kind of indicator:
test[i] = iCustom(Symbol(), NULL, "test", 0, 0); 
  1. Use SRC
  2. Does the indicator create values in buffer zero for bar zero?
  3. You should write a self documenting function instead of calling iCustom directly, see Detailed explanation of iCustom - MQL4 forum
BurkhardWille
176
BurkhardWille  
test[i] = iCustom(NULL, 0, "test", MA_MTF, 0, i);


 The first test works with the above code, thank you.

To add comments, please log in or register