Hi all,
How do I code html inside my indicator so I can set the Expert Commentary window to have font = Courier New
eg:
Commentary("Long Entry = " + numtostr(1356.2,"1) + "" + Newline);
I would like that line in ExpertCommentary window be be in Courier New format
++++++++++++++
I have done some homework but still can't figure it out
I can set the font on the chart textbox using Text_SetFontName (Text_Object,"Courier New");
but I need to change the Expert Commentary window as well
I went to this post and changed the internet explorer option so I can change the font size.
viewtopic.php?f=1&t=19389&p=70976&hilit ... ont#p70976
Change font in expert commentary window
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: Change font in expert commentary window
Any easy way to do that is probably with the `<span>` HTML element, since that one is for formatting/styling text. To do so, you'd use a `style` attribute with `<span>`.I would like that line in ExpertCommentary window be be in Courier New format
For instance, this piece of HTML code makes the text bold:
Code: Select all
<span style='font-weight: bold;'>hello!</span>
But now to answer your actual question. Here's an example:
Code: Select all
Variables:
formatStart(""),
message(""),
formatEnd("");
formatStart = "<span style='font-family: Courier New, monospace; font-size: 20px;'>";
message = "Bar close at " + NumToStr(Close, 1);
formatEnd = "</span>";
Commentary(formatStart + message + formatEnd);
Here's how that looks in the Expert Commentary:
- Attachments
-
- Expert_Commentary_2020-04-25_06-48-20.png
- (22.49 KiB) Not downloaded yet
Re: Change font in expert commentary window
Hi Josh,
Thank you very much. I really appreciate it. I have implemented it and it works great except for 1 small issue.
In the textbox on the chart I can use multiple spaces to "pad" out the information to make it look like a table
The problem is the multiple spaces do not show up in the Expert Commentary window
Do you know what I might be missing please?
Here is my original code
+++++++++++++++++++
I had a look at this website
https://crunchify.com/basic-html-how-do ... e-in-html/
to try and do it myself but I couldn't get it to work.
+++++++++++++++++++
Also an update for anyone else
You can't use the Internet Explorer fix I linked to earlier if you want to use the <span style='font-weight: bold;'>hello!</span> idea
viewtopic.php?f=1&t=19389&p=70976&hilit ... ont#p70976
Thank you very much. I really appreciate it. I have implemented it and it works great except for 1 small issue.
In the textbox on the chart I can use multiple spaces to "pad" out the information to make it look like a table
The problem is the multiple spaces do not show up in the Expert Commentary window
Do you know what I might be missing please?
Here is my original code
Code: Select all
Commentary(""+newline);
Commentary("using multiple spaces works in Textbox" + newline+newline);
Text_String = "" + newline +
"Buy @ "+NumToStr(L_Entry,Decimalz)+"" + newline +
"StopLoss @ "+NumToStr(L_FirstStop,Decimalz)+"" + newline +
"----------------" + newline +
"Target @ "+NumToStr(L_Target,Decimalz)+"" + newline ;
formatStart = "<span style='font-family: Courier New, monospace; font-size:" + numtostr(ecSize,0) + "px;'>";
formatEnd = "</span>";
Message = "Expert Commentary window problem when using multiple spaces" + newline;
Message = Message + "Long Entry = "+NumToStr(L_Entry,Decimalz)+"" + newline;
Message = Message + "Long StopLoss = "+NumToStr(L_FirstStop,Decimalz)+"" + newline;
Message = Message + "Trade Risk = "+NumToStr(L_Risk,Decimalz)+" pts" + newline +newline;
Message = Message + "Replace multiple spaces with dot works but doesn't look the best" + newline;
Message = Message + "Long Entry....= "+NumToStr(L_Entry,Decimalz)+"" + newline;
Message = Message + "Long StopLoss.= "+NumToStr(L_FirstStop,Decimalz)+"" + newline;
Message = Message + "Trade Risk....= "+NumToStr(L_Risk,Decimalz)+" pts" + newline;
Message = Message + "Replace multiple spaces with underscores works but doesn't look the best" + newline;
Message = Message + "Long Entry____= "+NumToStr(L_Entry,Decimalz)+"" + newline;
Message = Message + "Long StopLoss_= "+NumToStr(L_FirstStop,Decimalz)+"" + newline;
Message = Message + "Trade Risk____= "+NumToStr(L_Risk,Decimalz)+" pts" + newline;
Commentary(formatStart + message + formatEnd + newline);
I had a look at this website
https://crunchify.com/basic-html-how-do ... e-in-html/
to try and do it myself but I couldn't get it to work.
+++++++++++++++++++
Also an update for anyone else
You can't use the Internet Explorer fix I linked to earlier if you want to use the <span style='font-weight: bold;'>hello!</span> idea
viewtopic.php?f=1&t=19389&p=70976&hilit ... ont#p70976
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: Change font in expert commentary window
If you use multiple ` ` symbols in the text, one for each space, it should work properly. It's a bit annoying (and ugly), but you have to swap the ' ' (space) for ` ` in the sentence. That way it should work!The problem is the multiple spaces do not show up in the Expert Commentary window.
Here's what I got:
The code used:
Code: Select all
Variables:
formatStart(""),
message(""),
formatEnd("");
formatStart = "<span style='font-family: Courier New, monospace;font-size: 20px;'>";
message = "H e l l o !";
formatEnd = "</span>";
Commentary(formatStart + message + formatEnd);
- Attachments
-
- Expert_Commentary_2020-04-27_10-34-42.png
- (21.69 KiB) Not downloaded yet
- Anna MultiCharts
- Posts: 560
- Joined: 14 Jul 2017
- Has thanked: 42 times
- Been thanked: 141 times
Re: Change font in expert commentary window
Hello Kaos,
You can refer to HTML help, e.g: https://developer.mozilla.org/en-US/doc ... ndamentals
Our engineers have prepared a code example for you. The result of it is as shown in the screenshot.
You can refer to HTML help, e.g: https://developer.mozilla.org/en-US/doc ... ndamentals
Our engineers have prepared a code example for you. The result of it is as shown in the screenshot.
Code: Select all
var:
font_ita ("<span style='font-family: ; font-size:; font-style: italic;'>"),
font_nrm ("<span style='font-family: ; font-size; font-style: normal;'>"),
font_size20 ("<span style='font-family: ; font-size:20px; font-style: ;'>"),
font_size10 ("<span style='font-family: ; font-size:10px; font-style: ;'>"),
font_family_Courier_New ("<span style='font-family: Courier New; font-size:; font-style: ;'>"),
font_family_Arial ("<span style='font-family: Arial; font-size:; font-style: ;'>"),
preformatted_text_begin ("<pre>"),
preformatted_text_end ("</pre>");
Commentarycl("t e s t 1");
Commentarycl(preformatted_text_begin);
Commentarycl("t e s t 2");
Commentarycl(font_ita);
Commentarycl("t e s t 3");
Commentarycl(font_size20);
Commentarycl("t e s t 4");