RicardoSantos

Function 2 Point Line using UNIX TIMESTAMP V1

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.
Açık kaynak kodlu komut dosyası

Gerçek TradingView ruhuyla, bu betiğin yazarı, yatırımcının anlayabilmesi ve doğrulayabilmesi için onu açık kaynak olarak yayınladı. Yazarın eline sağlık! Bunu ücretsiz olarak kullanabilirsiniz, ancak bu kodun bir yayında yeniden kullanımı Kullanım Koşulları ile yönetilir. Bir grafikte kullanmak için favorilere ekleyebilirsiniz.

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.

Bu komut dosyasını bir grafikte kullanmak ister misiniz?
//@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)