Create your own target price – Tradingview Code

In fundamental analisys investors rely on “recommendation”: however, in many cases, professional anaysts use a technique with a marginal logic, i.e. they adjust progressively their last target prices. This could lead to “historical” price indications that are very far from the real situation (especially in the event of large drops in profit). Therefore, the indicator uses the EPS ttm and the historical P/E ration of the last 2 years (markets have “no memory”) to be able to set your personal target price and return that adjusts that of analysts. In the case of “big opportunities” it is always necessary to ask oneself whether personal evaluation is not “out of the market”. 

//@version=4

study(“Calcolo Target Price e Rendimento”, shorttitle=”Target Price”, overlay=true)

// Funzione per calcolare il P/E ratio

pe_ratio(eps) =>

 close / eps

// Funzione per calcolare il massimo P/E degli ultimi 2 anni

max_pe_2_years(eps) =>

 var float max_pe = na

 if (not na(eps))

 max_pe := na(max_pe) ? pe_ratio(eps) : max(max_pe, pe_ratio(eps))

 max_pe

// Input dell’EPS TTM

eps_ttm = input(defval=2.0, title=”EPS TTM”, type=input.float)

// Calcolo del massimo P/E degli ultimi 2 anni

max_pe = max_pe_2_years(eps_ttm)

// Calcolo del target price

target_price = max_pe * eps_ttm

// Calcolo del rendimento del target price rispetto al prezzo corrente

rendimento = (target_price / close) – 1

// Plotta il target price e il rendimento come linee separate

plot(target_price, title=”Target Price”, color=color.blue, linewidth=2)

// Aggiungi una freccia sull’ultimo prezzo che indichi il rendimento

var label rendimento_label = na

if (not na(rendimento))

 if (not na(rendimento_label))

 label.delete(rendimento_label)

 rendimento_label := label.new(bar_index, close, text=”Rendimento: ” + tostring(rendimento * 100, “#.##”) + “%”, xloc=xloc.bar_index, yloc=yloc.price, color=color.blue, textcolor=color.white, style=label.style_label_down, size=size.small)

———— Image from Tradingview with analysts’ target price (Price target indicator)———–

- / 5
Grazie per aver votato!

Lascia un commento