RE: Is it possible to have a chart label to show average stock price including reinvested dividends?
I have a label that shows average price line and another that shows stock profit. Would be nice to have a label that includes total profit including reinvested dividends and an average price line that included reinvested dividends.
# plot a horizontal line
# at the average price of your open position
def open_position_avg_price = GetAveragePrice();
# color the plot line based on position side
# quantity will be negative if short
def open_position_qty = GetQuantity();
def PnL_Line_Color = if open_position_qty < 0 then -1 else 1;
#debug
#plot PnL_Line_Color__plot = PnL_Line_Color;
# apply long or short logic to line color
plot open_position_avg_price__plot = if (open_position_avg_price <= 0) then Double.NaN else open_position_avg_price;
open_position_avg_price__plot.AssignValueColor(if PnL_Line_Color > 0 then Color.GREEN else Color.RED);
open_position_avg_price__plot.SetLineWeight(3);
I have a label that shows average price line and another that shows stock profit. Would be nice to have a label that includes total profit including reinvested dividends and an average price line that included reinvested dividends.
# plot a horizontal line
# at the average price of your open position
def open_position_avg_price = GetAveragePrice();
# color the plot line based on position side
# quantity will be negative if short
def open_position_qty = GetQuantity();
def PnL_Line_Color = if open_position_qty < 0 then -1 else 1;
#debug
#plot PnL_Line_Color__plot = PnL_Line_Color;
# apply long or short logic to line color
plot open_position_avg_price__plot = if (open_position_avg_price <= 0) then Double.NaN else open_position_avg_price;
open_position_avg_price__plot.AssignValueColor(if PnL_Line_Color > 0 then Color.GREEN else Color.RED);
open_position_avg_price__plot.SetLineWeight(3);
Last edited by a moderator: