experimental:
draws a line from 2 vectors(price, time)
update:
reformatted the function,
added automatic detection of the period multiplier by approximation(gets a bit goofy with stocks/week time),
example using timestamp() function.
offsetting is still bugged, i cant find a way around it atm.
draws a line from 2 vectors(price, time)
update:
reformatted the function,
added automatic detection of the period multiplier by approximation(gets a bit goofy with stocks/week time),
example using timestamp() function.
offsetting is still bugged, i cant find a way around it atm.
//@version=2 study(title='Function 2 Point Line using UNIX TIMESTAMP V1', shorttitle='f', overlay=true) offset = input(100) _p0 = 4.92 _t0 = timestamp(2011, 12, 19, 0, 0) _p1 = 6.72 _t1 = timestamp(2012, 05, 21, 0, 0) f_2p_line(_price0, _time0, _price1, _time1, _shift) => _period_multiplier = lowest(change(time), 10) _diference_in_price = (_price1 - _price0) _diference_in_time = (_time1 - _time0) _fraction = (_diference_in_price / _diference_in_time) _current_time_plus_offset = (time + (_shift*_period_multiplier)) _return = _price0 + (_fraction * (_current_time_plus_offset - _time0)) plot(f_2p_line(_p0, _t0, _p1, _t1, offset), color=color(blue, 0), offset=offset)