int start()
{
int i,counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit=MathMin(Bars-1,Bars-counted_bars);
for (i=limit; i>=0; i--){
highestHigh[i] = High[iHighest(NULL,0,MODE_HIGH,timePeriod,i)];
lowestLow[i] = Low[iLowest(NULL,0,MODE_LOW,timePeriod,i)];
threshold[i] = percent * (highestHigh[i] - lowestLow[i]);
upArrow[i] = EMPTY_VALUE;
downArrow[i] = EMPTY_VALUE;
if((highestHigh[i] - Close[i]) < threshold[i])
{
downArrow[i] = High[i] + iATR(NULL,0,20,i);
}
if((Close[i] - lowestLow[i]) < threshold[i])
{
upArrow[i] = Low[i] - iATR(NULL,0,20,i);
}
}
return(0);
}