How to add a label to a level

If you need an Indicator or Signal developed or translated from other language, please post all Indicator development REQUESTS to this section here.

Moderator: admin

How to add a label to a level

Postby Ephedan » Mon Nov 08, 2021 10:10 am

Hello everyone.

I am asking you because I want to display at the end of each line the name of the level and the associated price. (see screenshot)

Example.png
Example of what i want

Screenshot indicator.png
The indicator where I want the labels to appear


I found these items on the site, but it doesn't inspire me at all.
- https://fxcodebase.com/documents/Indico ... Label.html
- https://fxcodebase.com/documents/Indico ... abel1.html

Thanks for your help.
Attachments
MTD_indicateur.lua
(15.38 KiB) Downloaded 91 times
Ephedan
 
Posts: 15
Joined: Thu Jul 15, 2021 10:18 am

Re: How to add a label to a level

Postby Apprentice » Mon Nov 08, 2021 12:29 pm

Your request is added to the development list.
Development reference 973.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36435
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: How to add a label to a level

Postby Apprentice » Wed Nov 10, 2021 6:01 am

Try this version.
MTD_indicateur.lua
(16.29 KiB) Downloaded 101 times



While "drawLabel1" and especially context: drawText offer more options,
"drawLabel" is the simplest by far.

If you want to learn more, consider my SDK introductory course
https://www.patreon.com/mariojemic

And yes, go easy with the tostring()
You only need to use them if you want to turn something into a string.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36435
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia


Re: How to add a label to a level

Postby Ephedan » Wed Nov 10, 2021 10:17 am

Hello.

Thank you for your feedback and your suggestions. I admit that I would never have been able to do this without you. Thank you once again.

I have one last question, how is it possible to shift the labels to the right.
I went to "https://fxcodebase.com/documents/IndicoreSDK/host.execute_drawLabel.html", I can see the "Level" parameter. So I deduce that this is where you have to put your parameter.
I tried but convincing.

Do you have an idea ?

Best regards,
Ephedan
 
Posts: 15
Joined: Thu Jul 15, 2021 10:18 am

Re: How to add a label to a level

Postby Apprentice » Thu Nov 11, 2021 3:52 am

"drawLabel" work with dates

corehost:execute ("drawLabel", id, date, level, text)
date+1 will move for one day

CandleSize= source:date(source:size()-1) - source:date(source:size()-2);
date+CandleSize wil move for one candle

Other Label options are better for shifting.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36435
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia


Return to Indicator and Signal Requests

Who is online

Users browsing this forum: No registered users and 8 guests