Everything God Created Is Good...
'Everything God created is good, and nothing to be rejected if it is received with thanksgiving.' 1 Timothy 4:4
Yes, nothing is to be rejected...even the bad things. So we should give praise to God even when we are in the valley. If we are faithful to Him, He is faithful to us. In reality, He is faithful to us regardless of our faithfulness. For He is not a man who can lie; He is God. He will never take back a promise He made to His children, even though we deserve none of them.
So when things look bleak, or you are lonely, or you are struggling in a big way, remember that God is still refining you, and He will show you once you are on the other side of that trial exactly what He was doing in you. Once we come out of that valley, the view from the mountaintop is like nothing else! Give Him praise, give Him thanks, in the bad times, and in the good times too. For He is your God.