Variable:
HighestHigh(0),
LowestLow(0),
highestBarlocation(0),
LowestBarlocation(0);
If BarNumber = 1 Then
Begin
HighestHigh = -99999;
LowestLow = 99999;
End;
if high > highesthigh then
Begin
HighestHigh = high;
HighestBarlocation = currentbar;
End
Else
If low < lowestlow then
Begin
LowestLow = low;
LowestBarlocation = currentbar;
End;
If LastBarOnChart = True Then
Begin
print(" ");
print("Current bar = ",currentbar:5:0);
print("The highest high was ",HighestHigh:4:4,
" took place at bar# ", HighestBarlocation:5:0,
" which was ", currentbar - HighestBarlocation:5:0,
" bars ago.");
print("Lowest low was ", LowestLow:4:4,
" took place at bar# ", LowestBarlocation:5:0,
" which was ", currentbar - LowestBarlocation:5:0,
" bars ago.");
End;