You most definetly are doing something wrong
170g protein=680 calories
300g carbs=1200 calories
So that leaves 2120 calories left for your suppossed 4k+ calorie intake. I doubt your eating 235g of fat (235g of fat=2120 calories)
So, all of that leads me to believe that you are under eating and actually aren't taking in 4,000+ calories per day and you need to count your stuff correctly
If you actually are eating 4k+ then you will undoubtedly gain weight, unless your expenditure is so high that you burn those calories off.
It's simple. If you aren't gaining, then you aren't eating enough. Go eat a hamburger!