Custom drawing tool coded for TradingView
Drawing tool allows user to mouse-click bars to be selected, to calculate a cumulative VWAP of those selected bars. The number of bars will vary (e.g. 1-10 bars), and the bars may or may not be sequential.
The VWAP is then plotted as a horizontal line. The price of the horizontal line will only change once plotted, if the selected bars include a current unfinished bar, otherwise it will just be a stationary horizontal line.
The drawing tool then has an option to (optionally) plot up to 4 parallel lines, at a percent offset from the VWAP horizontal line. E.g. -2%, -1.5%, +0.5%, +3%.
The calculation for the 0.5% Parallel line would be as follows: (0.05 * VWAP Price) + VWAP Price = Parallel Line.
I will need to also be able to set alerts on the price interacting with the horizontal line in TradingView, using their standard Alert options.
Price input to chose: OHLC/4, Close
Line style: segment or ray. If segment, option to chose the length of the horizontal line.