@bhupen_a, there is no python / pinescript code for drawing shape objects on TradingView Chart. There is PineScript but it is for creating custom indicators.
@108909739911298060124, you can use Fibonacci Tool with 50% retracement which will plot shape same as Rectangle with Middle Line.
@communications_team needs to upgrade to latest TradingView charting library to include this Rectangle midline feature which is available on native TradingView.com but it will take atleast several months for them to do so.