Line generator on Pine Script

Job ID: 30890653

Budget: $30 – $250 USD

I have a script that I wrote on Pine Script (TradingView's proprietary code language). The script is supposed to user inputted candles, the start candle and the pivot candle, and draw a ray from the high, low, body high, or body low of the start candle to the pivot candle; it then draws a line on the next candle to the pivot candle and so on. I have the first draft done, but I am stuck and don't know where to start to fix the bugs.

That is the main idea, one of the minor details I want is that I want it to work on a chart that isn't the current chart being if it is possible. So I would like the Bitstamp BTC chart lines to display on the Bybit BTC chart (because Bitstamp goes back further).
Related categories: Pine Script