Hi
I am trying to display a text label on a chart from within an indicator, at the current time and just above or below the current price when a Bollinger band is breached
I have used core.host:execute("drawLabel1", .... and I have step traced my code and the line executes during the trace but when I install and run it nothing is displayed when it should be. I want to display a literal when the price moves outside a Bollinger band
I notice in the indicor SDK 3 help on the public method host:execute("drawLabel1", ...) page that there is a note at the bottom which says "Note: This function is optional and may be not supported by the host application." Could this be the reason I am not getting anything on the chart? I am running Marketscope 2.0 . I also looks like the system is slowed a bit when I run the indicator
I used the example from help and tailored it
My code for when price breaks above the top band is as follows:
if source:tick(-1) > TL:tick(-1) and -- The Top Line is being breached
G_TL_DISPLAYED ~= period then -- and not yet displayed this candle
G_TL_DISPLAYED = period; -- Set the "displayed" indicator for this candle
G_LAST_BREACH = G_TL; -- Stored for when price gets to the Mid-Line
--------------------------------------------------------------------------------
-- calculate the position to display the literal and display it
--------------------------------------------------------------------------------
G_ID = G_ID + 1; -- increment the label ID
core.host:execute("drawLabel1",
G_ID,
core.now(), -- the current local time and date
core.CR_CHART,
source:tick(-1) + (G_TL_PIP_GAP /10000), -- The gap to create above the current price and is correct
core.CR_CHART,
core.H_Right,
core.V_Bottom,
G_FONT, -- Used Arial and during trace is C40A31DD
G_FONT_COLOUR, -- used red and during trace is 255.000000
G_TL_LITERAL); -- contains TL during trace test as it should
end
I created G_FONT in Prepare as follows
----------------------------------------------
-- Create the text font
----------------------------------------------
G_FONT = core.host:execute("createFont",
instance.parameters.FONT_NAME,
instance.parameters.FONT_SIZE,
instance.parameters.FONT_ITALIC,
instance.parameters.FONT_BOLD);
Could somebody please be so kind as to help me as i am very new to indicore and rather embarrassed to ask
If have attached the indicator in case you want to run it
Hoping for a response