Custom lines with labels. How to plot text next to the plotted line on the chart

There are many possible ways, but this one is probably the simplest:

M1 = LastVisibleValue(HHV(H, 10)); // Example
N1 = LastVisibleValue(LLV(L, 10)); // Example
LVBI = LastVisibleValue(BarIndex());

PlotOHLC(M1, M1, N1, N1, "", colorLightYellow, styleCloud|styleNoLabel, Null, Null, 0, -5, 1);
Plot( M1, "M1", colorLightBlue, styleLine|styleThick|styleNoRescale );
Plot( N1, "N1", colorLightBlue, styleLine|styleThick|styleNoRescale );

PlotTextSetFont("   M1   ", "Arial black", 10,  LVBI - 5, M1, colorGreen, colorLightGrey, -5);
PlotTextSetFont("   N1   ", "Arial black", 10,  LVBI - 5, N1, colorRed, colorLightGrey, -5);

Lines%203

17 Likes