Short term energy signal explanation
For initializing window you need the start point would depend on your overlap. If the overlap is 50% then you would start at window_length/2
If you are using a rectangular window and with 50% overlap in that case you want to use a square root rectangular window on the input and output so that there are no scaling issues. so basically you window will be scaled also dependent on your overlap.

Also it would be worthwhile to consider using other windows dependent on your application. As in a lot of other windows the scaling is taking into account.