Help coding ea

Johanes Indrajaya  

I'd include the indicator but I think there's an error at this code:


int i_ma() {
   double ima_high = iCustom(NULL,0,"DynamicRS",5,25,MODE_HIGH,0);
   double ima_low = iCustom(NULL,0,"DynamicRS",5,25,MODE_LOW,1);
   if (Close[1] < (ima_high + 5)) return (-2);
   if (Close[1] > (ima_low - 5)) return (2);
   return (0);
}
Tjipke de Vries  
johanesvi:

I'd include the indicator but I think there's an error at this code:

double ima_high = iCustom(NULL,0,"DynamicRS",5,25,MODE_HIGH,0);     //    bar number to calculate buffervalue 'mode' from indicator "DynamicRS"
   double ima_low = iCustom(NULL,0,"DynamicRS",5,25,MODE_LOW,1);   //wrong

mode - Line index. Can be from 0 to 7 and must correspond with the index used by one of SetIndexBuffer functions.

looks like the name mode is confussing you

an indicator can have 8 buffers maximum you can read with using iCustom

mode stands for the buffer of the indicator you wanna read

it has nothing to do with mode_high mode_low mode_open or ........

the last parameter is for the bar you want the value from

Johanes Indrajaya  
deVries:

mode - Line index. Can be from 0 to 7 and must correspond with the index used by one of SetIndexBuffer functions.

looks like the name mode is confussing you

an indicator can have 8 buffers maximum you can read with using iCustom

mode stands for the buffer of the indicator you wanna read

it has nothing to do with mode_high mode_low mode_open or ........

the last parameter is for the bar you want the value from


OK, I got it... thanks for your explanation.