I'm trying to make the edits myself. I am guessing from other tools what the needed code might be.
Here is what I have got from looking at other tools with the requested change but I cannot get it to work.
Theoretically, this does not sound complicated to add a label, draw line and do a simple calculation but I do not how to code that. Please help!
To begin, I think it needs label text colour:
indicator.parameters:addColor("Text_color", "Text color", "Text color", core.rgb(0, 0, 0));
indicator.parameters:addInteger("TextSize", "Text size", "Text size", 6);
Then, the options for the line (colour, style and width)
indicator.parameters:addColor("clr", "Open Line Color", "", core.rgb(192, 192, 192));
indicator.parameters:addInteger("Style", "Line Style", "", core.LINE_DOT);
indicator.parameters:addInteger("Width", "Line Width", "", 1, 1, 5);
Then, data source to calculate the difference between high and low, in pips
local hilo_data = nil; -- the high/low data
local H; -- high stream
local L; -- low stream
local O; -- open stream
-- the function which is called to calculate the period
function Update(period, mode)
-- get date and time of the hi/lo candle in the reference data
hilo_candle = core.getcandle(BS, source:date(period), offset, weekoffset);
-- if data for the specific candle are still loading
-- then do nothing
if loading and hilo_candle >= loadingFrom and (loadingTo == 0 or hilo_candle <= loadingTo) then
After this, I don't know what else to do and where to place these lines.
Thanks for any help available.