Modify anchor type of line

Hey I want to create an EA that draw line on the right side as in the picture, but the horizontal anchor being time make it impossible to set an anchor point past the last candle. 

I first planned to set all anchor on the last candle then use extend right, but it's kind of my last solution, due to lack of readability

Does someone have a better idea? 


Use objects that doesn't require time but XY. Or use Canvas.