Sub NewArray1()
'Did not include the Dim statements
LastRow = ActiveSheet.UsedRange.Rows.Count
ReDim Preserve LowCellValue(0 To LastRow, 0 To LastRow)
ReDim Preserve HighCellValue(0 To LastRow, 0 To LastRow)
ReDim Preserve Diff(0 To 2, 0 To LastRow)
'Set up LowLoopCount LoopStart and LoopEnd values for initial loop
If LowValueCount = 0 Then LowValueCount = 2
If LowLoopCount = 0 Then LowLoopStart = 2
If LowLoopCount = 0 Then LowLoopEnd = 9
'Buy, Sell and stop signals
Buy1 = 1
Buy2 = 1.236
Buy3 = 1.382
Buy4 = 1.5
Sell1 = 0.618
Sell2 = 0.786
Sell3 = 1
Sell4 = 1.236
Stop1 = 1.236
Stop2 = 1.382
Stop3 = 1.5
Stop4 = 1.618
For LowLoopCount = LowLoopStart To LowLoopEnd
'Set up loop LowLoopCount LoopStart and LoopEnd values for all loops
If LowLoopCount > 2 Then LowLoopStart = HighLoopEnd + 1
If LowLoopCount > 2 Then LowLoopEnd = HighLoopEnd + 7
HighLoopStart = LowLoopEnd + 1
HighLoopEnd = LowLoopEnd + 7
Value = Value + 1
If LowLoopEnd >= LastRow Then LowLoopEnd = LastRow
'Calculate Range for MinValue and Maxvalue
MinValue = Application.WorksheetFunction.Min(Range("D" & LowLoopStart & ":" & "D" & LowLoopEnd))
MaxValue = Application.WorksheetFunction.Max(Range("C" & HighLoopStart & ":" & "C" & HighLoopEnd))
'Calculate Cell that Minvalue is in
For Each Cell In Range("D" & LowLoopStart & ":" & "D" & LowLoopEnd)
If Cell.Value = MinValue Then _
Cell.Interior.Color = vbRed
If Cell.Value = MinValue Then _
LowCellValue(1, Value) = MinValue
Next Cell
If HighLoopStart > LastRow Then Exit Sub
If HighLoopEnd > LastRow Then Exit Sub
'Turn Cell green that Maxvalue is in
For Each Cell In Range("C" & HighLoopStart & ":" & "C" & HighLoopEnd)
If Cell.Value = MaxValue Then _
Cell.Interior.Color = vbGreen
'If Cell.Value = MaxValue Then _
'Cells("C",
'.Address("C", True) = MaxCellCount
'Assign MaxValue
If Cell.Value = MaxValue Then _
HighCellValue(1, Value) = MaxValue
'Calculate Difference between Max and Min value
If Cell.Value = MaxValue Then _
Diff(1, Value) = (MaxValue - MinValue)
[Red] 'Calculate First Buy Point
If Cell.Value = MaxValue Then _
Range("G" & Cell.Value).Formula = (((MaxValue - (Diff(1, Value)) * Buy1)))[/Red]
Next Cell
Next LowLoopCount
End Sub