for(int i=limit-1; i>=0; i--)
{
double MAUP1 = iMA(NULL,0,MAPeriod,-MoveShift,MODE_SMA,PRICE_HIGH,i);
double BB_UP = iBands(NULL,0,BPeriod,Std,0,PRICE_HIGH,MODE_UPPER,i);
double MA_HIGH = iMA(NULL,0,4,0,MODE_LWMA,PRICE_HIGH,i);
double MADN1 = iMA(NULL,0,MAPeriod,-MoveShift,MODE_SMA,PRICE_LOW,i);
double BB_DN = iBands(NULL,0,BPeriod,Std,0,PRICE_LOW ,MODE_LOWER,i);
double MA_LOW = iMA(NULL,0,4,0,MODE_LWMA,PRICE_LOW,i);
if (MAUP1>BB_UP) {ExtMapBuffer1[i]=MAUP1+Dist2*Point; BB_UP=EMPTY_VALUE ;}
else if (MAUP1<BB_UP) {ExtMapBuffer1[i]=BB_UP ; MAUP1=EMPTY_VALUE ;}
//--------------------------------------------------------------------
if( MADN1 >0.0 )
{
if ( MADN1<BB_DN) {ExtMapBuffer2[i]=MADN1-Dist2*Point; BB_DN=EMPTY_VALUE ;}
else if (MADN1>BB_DN) { ExtMapBuffer2[i]=BB_DN ; MADN1=EMPTY_VALUE ; }
}
if (MADN1 ==0.0 ) { ExtMapBuffer2[i]=BB_DN; MADN1=EMPTY_VALUE ;}
}