I am trying to get the highest and lowest value from last 20 bar. I have no issue to obtaining highest value, however my code doesn't seem to work properly in order to obtain the lowest value. Just wondering if there is any suggestion about it.
OnEveryNewBar1();
void OnEveryNewBar1()
{ PipValue = 1;
if ( NDigits == 3 || NDigits == 5 ) PipValue = 10;
if ( BarTime1 < Time[0] ) // we have a new bar opened
{ BarTime1 = Time[0]; // keep the new bar open time
TechnicalAnalysis_S();
TechnicalAnalysis_L();
}
}
void TechnicalAnalysis_S()
{
int m = 2;
int n = 3;
l = 1000;
while ( m <= 20 )
{
if ( 1 < 2 )
{ if ( ( Close[2] > Open[2] ) || ( Close[1] > Open[1] ) ) int i = 2;
while ( i > 0 )
{
if ( Low[i] < l ) l = Low[i];
i = i - 1;
}
print ( "Lowest" + l );
l = 1000;
}
m++;
n++;
}
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void TechnicalAnalysis_L()
{
int m = 2;
int n = 3;
while ( m <= 20 )
{
if ( 2 > 0 )
{
if ( ( Close[2] < Open[2] ) || ( Close[1] < Open[1] ) ) int i=2;
while ( i > 0 )
{
if ( High[i] > h ) h = High[i];
i = i - 1;
}
print ( "Highest" + h );
h = 0;
}
m++;
n++;
}
}