Trader273/jonik,
This is code for a similar indicator I use. It places a trend line (extended to the right) at the hi and lo of the previous bar, and annotes the hi/lo prices and the range differential between them. Perhaps you can modify this to meet jonik's format.
//ID_64100
// High Low Range
// Courtesy of tradingkevin
// <a href="https://www.tradestation.com/Discussions/Topic.aspx?Topic_ID=64100'>https://www.tradestation.com/Discussions/Topic.aspx?Topic_ID=64100 " target="_blank">https://www.tradestation.com/Discussions/Topic.aspx?Topic_ID=64100 </a>
{
shows on the chart the HIGH-LOW and the range in ticks
between those 2 extrems for the last bar close.
}
input:TextColor(White),LineColor(White),LineWeight (0),LineLength(3),DecimalPlaces(0);
var:init(false),ed(0),et(0),tl1(0),tl2(0),tx1(0),tx2(0),tx3(0);
if lastbaronchart then begin
ed=d;
et=timetominutes(t)+linelength;
if et>1439 then begin
ed=juliantodate(datetojulian(ed)+1);
et=et-1440;
end;
et=minutestotime(et);
if init then begin
tl_setbegin(tl1,d[1],t[1],h[1]);
tl_setbegin(tl2,d[1],t[1],l[1]);
tl_setend(tl1,ed,et,h[1]);
tl_setend(tl2,ed,et,l[1]);
text_setstring(tx1," "+numtostr(h[1],decimalplaces));
text_setstring(tx2," "+numtostr(l[1],decimalplaces));
text_setstring(tx3,"+ "+numtostr(h[1]-l[1],decimalplaces));
text_setlocation(tx1,ed,et,h[1]);
text_setlocation(tx2,ed,et,l[1]);
text_setlocation(tx3,ed,et,(h[1]+l[1])/2);
end else begin
tl1=tl_new(d[1],t[1],h[1],ed,et,h[1]);
tl2=tl_new(d[1],t[1],l[1],ed,et,l[1]);
tl_setcolor(tl1,linecolor);
tl_setcolor(tl2,linecolor);
tl_setsize(tl1,lineweight);
tl_setsize(tl2,lineweight);
tl_setstyle(tl1,1);
tl_setstyle(tl2,1);
if datacompression=0 then begin
tl_setextleft(tl1,true);
tl_setextleft(tl2,true);
end else begin
tl_setextleft(tl1,false);
tl_setextleft(tl2,false);
end;
tl_setextright(tl1,false);
tl_setextright(tl2,false);
tx1=text_new(ed,et,h[1]," "+numtostr(h[1],decimalplaces));
tx2=text_new(ed,et,l[1]," "+numtostr(l[1],decimalplaces));
tx3=text_new(ed,et,(h[1]+l[1])/2,"+ "+numtostr(h[1]-l[1],decimalplaces));
text_setcolor(tx1,textcolor);
text_setcolor(tx2,textcolor);
text_setcolor(tx3,textcolor);
text_setstyle(tx1,0,2);
text_setstyle(tx2,0,2);
text_setstyle(tx3,0,2);
init=true;
end;
end;