I need help on the iCustom coding

 

Need help with code . Seems like I have got the wrong parameters ;<(


double FracUp_2 = iCustom(0,PERIOD_H4,"NewFracs",MODE_UPPER,2);


if(FracUp_2 !=0) ..........( This works with the Bill Williams Fractal Indicator . ifractals(0,PERIOD_H4,MODE_UPPER,2)


Indicator below


//+------------------------------------------------------------------+
//| NewFracs.mq4 |
//| |
//| |
//+------------------------------------------------------------------+

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red



extern int TimeFrame=240;

double ExtMapBuffer1[];
double ExtMapBuffer2[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{

//---- indicator line

SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,119);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,119);

//---- name for DataWindow and indicator subwindow label
switch(TimeFrame)
{
case 1 : string TimeFrameStr="Period_M1"; break;
case 5 : TimeFrameStr="Period_M5"; break;
case 15 : TimeFrameStr="Period_M15"; break;
case 30 : TimeFrameStr="Period_M30"; break;
case 60 : TimeFrameStr="Period_H1"; break;
case 240 : TimeFrameStr="Period_H4"; break;
case 1440 : TimeFrameStr="Period_D1"; break;
case 10080 : TimeFrameStr="Period_W1"; break;
case 43200 : TimeFrameStr="Period_MN1"; break;
default : TimeFrameStr="Current Timeframe";
}
IndicatorShortName("Fractals "+TimeFrameStr);
}
//----
return(0);

//+------------------------------------------------------------------+
//| MTF Fractals |
//+------------------------------------------------------------------+
int start()
{
datetime TimeArray[];
int i,shift,limit,y=0,counted_bars=IndicatorCounted();

// Plot defined timeframe on to current timeframe
ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame);

limit=Bars-counted_bars+TimeFrame/Period();
for(i=0,y=0;i<limit;i++)
{
if (Time[i]<TimeArray[y]) y++;



ExtMapBuffer1[i]=iFractals(NULL,TimeFrame,1,y);
ExtMapBuffer2[i]=iFractals(NULL,TimeFrame,2,y);


}

//



return(0);
}
//+-------------------------------------------------------
 

i tried like this in one of my EA's and worked fine.


double FracUp_2 = iCustom (NULL, PERIOD_H4, "NewFracs", 240, 0, i + 2); // for resistance
double FracDown_2 = iCustom (NULL, PERIOD_H4, "NewFracs", 240, 1, i + 2); // for support

 

i trying to transfer a custom indicator into ea can anyone tell me how to do the following in ea or what does it mean?

i having problem understanding what extmapbuffer1[i-ssp+6] mean and how to translate them in ea

for(i=CountBars-SSP;i>=0;i--) { 
 
   smin = SsMin-(SsMax+SsMin)*Kmin/100; 
   smax = SsMax*(SsMax+SsMin)*Kmax/100;  
   ExtMapBuffer1[i-SSP+6]=smax; 
   ExtMapBuffer2[i-SSP-1]=smax; 
   val1 = ExtMapBuffer1[0]; 
   val2 = ExtMapBuffer2[0]; 
if (val1 > val2) Comment("buy ",val1); 

if (val1 < val2) Comment("sell ",val2); 
 
dotzoo:

i trying to transfer a custom indicator into ea can anyone tell me how to do the following in ea or what does it mean?

i having problem understanding what extmapbuffer1[i-ssp+6] mean and how to translate them in ea

extmapbuffer1[i-ssp+6] is one value (pe. 1.2323) of your custom indicator but shifted [i-ssp+6], is not the actual i suppose.

use iCustom function to call the extmapbuffer1 value.

 
bgaiteiro:

i tried like this in one of my EA's and worked fine.


double FracUp_2 = iCustom (NULL, PERIOD_H4, "NewFracs", 240, 0, i + 2); // for resistance
double FracDown_2 = iCustom (NULL, PERIOD_H4, "NewFracs", 240, 1, i + 2); // for support

Tks that worked good :<)

Reason: