you might want to consider to bring the iCustom call on WOH1 and WOH2 in-house
Code: Select all
//+------------------------------------------------------------------+
//| GetWOH() |
//+------------------------------------------------------------------+
GetWOH(string symbol, int tf, int shift)
double wo, ma, v;
int nLimit, i;
int nCountedBars;
nCountedBars = IndicatorCounted();
//---- check for possible errors
if(nCountedBars<0) return(-1);
//---- last counted bar will be recounted
if(nCountedBars>0) nCountedBars--;
nLimit = Bars-nCountedBars;
if(nLimit>barsToProcess) nLimit=barsToProcess;
//---- main loop
for(i=0; i<nLimit; i++)
{
// DownBuffer[i] = 0.0;
// UpBuffer[i] = 0.0;
// ZeroBuffer[i] = 0.0;
if(TimeDayOfWeek(iTime(symbol,0,i))==0)
{
if(Trigger==true)
{
Trigger=false; // Trigger fired
j++;
}
}
if(i==0 || i==1) j=0;
if(TimeDayOfWeek(iTime(NULL,0,i))!= 0) Trigger=true; // Trigger reset
wo = iMA(symbol,PERIOD_W1,2,1,MODE_LWMA,PRICE_OPEN,j);
ma = iMA(symbol,0,1,0,MODE_SMA,PRICE_MEDIAN,i);
v = NormalizeDouble(ma-wo,Digits)
return ( v );
}
//----
return(0);
}