Is it possible to add a note to a chart that isn’t time specific, so that it is always visible whenever you open the chart?
Basically I’d like to have reminders or notes about a chart whenever I open it, say at the top of the chart? It seems a basic function, but I can’t work out how to do it.
Many thanks in advance.
Hi,
you can use these added instructions last year using screen pixels:
New drawing instructions: anchoring in pixels
Many thanks for such a speedy reply; that looks to be what I’m looking for 👍.
I’ve had a look at that, and I think it will help, if I can get it to work.
Could you explain, or preferably illustrate, exactly the code to get the text to appear please? I understand the various definitions, but am unsure how to get the text on the screen in the first place.
If you take second post from Nicolas in that link, number #190103 the second example and its explanation is a good illustration:
Write the word “test” 50 pixels to the right and 30 pixels higher than the bottom-left corner of the graph.
drawtext ("test", 50 ,30) anchor(bottomleft)
As you talked about the top, similarly you can use the middle-top as anchor, and use negative pixel value on vertical axis to go below top edge :
drawtext ("test", 0 , -30) anchor(top)
I understand that, I just don’t understand where I use it; I tried to create an indicator with that code but it didn’t work, and I’m otherwise at a loss I’m afraid.
I just noticed you posted in “platform support” forum, I’ll move shortly this topic to the forum specific to custom indicators: the “probuilder forum”. This recommendation for forum use and a few others may be found in the yellow background box at bottom of this page, please have a quick look if not familiar with them, thanks.
List of all available forums to route topics: https://www.prorealcode.com/forums/
Ok, you need to click on the indicators button, either at top of chart if using PRT v12 (or even the good old v10.3), or at bottom left if using PRT v11. And there, instead of the simplified creation window, you need to use the creation by code, not forgetting the traditional “return” line at the end of the script.
Then you give your indicator a name, execute it, save it, it should appear as a separate window below price window. After it’s saved, it is now available in your indicators list. Then you need to add it to your price window, if you haven’t done it before, here is how in 1mn video:
https://www.prorealcode.com/blog/video-tutorials/how-to-add-an-indicator-on-price-prorealtime/
drawtext ("test", 0 , -30) anchor(top)
return
Sorry, was a bit out of practice with my coding, it’s working now thanks.
One last question, I have tried the search function but without success I’m afraid.
Is there a way of reading the chart name (eg the particular stock or forex pair) and using that to add a specific text message for that stock with a simple
if NAME = “TSLA” then
drawtext (etc)
endif
It’s not possible for code to read the chart. Additionally, the sole data type supported is the floating point numeric type.
Ok, thanks.
Might that be something to consider for future versions or would the structure of the charts mean it will never happen?