Change default Title text color

Hi all,
How do we change the Title text color in the default Amibroker chart title below:

_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
_SECTION_END();

I found some tutorial on customizing char titles. However, it is suggesting to use EncodedColor. Something like below

Title = "Close Price: " +EncodeColor( colorRed ) + NumToStr( Close, 1.2 );

Is it possible to modifiy the default title instead?

Thanks in advance.
bursana

Hi, found the solution to this by using EncodedColor() as below:

_N(Title = EncodeColor(colorBlack) + StrFormat("{{NAME}} ({{INTERVAL}}), {{DATE}} ; {{OHLCX}}, V=%1.0f\n {{VALUES}}\n\n", V));

However, when I change my background to white using

SetChartBkColor(ParamColor("Outer panel",colorBlack)); // color of outer border 
SetChartBkGradientFill( ParamColor("Inner panel upper",colorWhite),ParamColor("Inner panel lower",colorWhite));

The text of EMA() value is white as below:
Broker_2017-11-27_13-01-03

I think this is because I choose Black as my Predefined chart theme in Preferences (due to other compatibility with other chart panels).

My full code is below. Basically I want to reproduce the Basic Chart theme (black/white) in only one chart window while my other chart windows follow the set Black chart theme in the Preferences.

_SECTION_BEGIN("Price");
_N(Title = EncodeColor(colorBlack) + StrFormat("{{NAME}} ({{INTERVAL}}), {{DATE}} ; {{OHLCX}}, V=%1.0f\n {{VALUES}}\n\n", V));
_SECTION_END();

SetChartBkColor(ParamColor("Outer panel",colorBlack)); // color of outer border 
SetChartBkGradientFill( ParamColor("Inner panel upper",colorWhite),ParamColor("Inner panel lower",colorWhite));

Insidecolor=IIf(C<O,colorBlack,colorWhite);

SetBarFillColor(Insidecolor);

PlotOHLC( Open, High, Low, Close, " " ,  styleCandle | styleThick );

_SECTION_BEGIN("EMA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1, 10 );
Plot( EMA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") ); 
_SECTION_END();

_SECTION_BEGIN("EMA1");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1, 10 );
Plot( EMA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") ); 
_SECTION_END();

Is there a way to change the color of EMA() value text to black (overriding the predefined chart theme)?

I think if you have to be after
ParamColor( “Color”, colorCycle )…

EX :
ParamColor( “EMA1 Color”, colorCycle )…

ParamColor( “EMA 2 Color”, colorCycle )…

It should let you pick color you want in parameters window apart from giving default color

Hi @amsai, thanks for your reply.
I think you are referring to the color of the EMA plot line. Correct me if I’m wrong.

Actually my question is regarding the color of the EMA() value text printed in the Title. Would like to change that to black from within the StrFormat if possible. I think Amibroker default it to white when I select “Black” as my Predefined Chart template in the Preferences.

i am also learner . What you can do is, whichever value you wanted to have take out from strformat and add color … Please try …

_N(Title = EncodeColor(colorBlack) + StrFormat("{{NAME}} ({{INTERVAL}}), {{DATE}} ; {{OHLCX}}, V=%1.0f\n {{VALUES}}\n\n", V));

I moved out Date from this and added blue color to it .(Not tested) …but usually this should do per my understanding

_N(Title = EncodeColor(colorBlack) + StrFormat("{{NAME}} ({{INTERVAL}})  ; {{OHLCX}}, V=%1.0f\n {{VALUES}}\n\n"+  EncodeColor(colorBlue) + "{{DATE}} ", V));

In your code i am not sure which one is having EMA value

@amsai
Because EMA value text is automatically added to the title, can you guide me on how to do this for the EMA() value text?

e.g.
Let say, the title would be “EMA(Close, 15) = 0.999”.
The “EMA(Close, 15)” part color will automatically follow the EMA line color.
But the color for " = 0.999" is the one following predefined chart theme color. Would like to manually change this to black.

thanks.

This is how i achieve it .. You can expand .. Pretty sure they will be a better way...


_SECTION_BEGIN("EMI Price");


SetChartBkColor(ParamColor("Outer panel",colorBlack)); // color of outer border 
SetChartBkGradientFill( ParamColor("Inner panel upper",colorWhite),ParamColor("Inner panel lower",colorWhite));

Insidecolor=IIf(C<O,colorBlack,colorWhite);

SetBarFillColor(Insidecolor);

PlotOHLC( Open, High, Low, Close, " " ,  styleCandle | styleThick );

 
Pema1 = ParamField("Price field EMA1 ",-1);
Periodsema1 = Param(" EMA 1 Periods", 10, 2, 300, 1, 10 );
EMA1 =  EMA( Pema1, Periodsema1 ) ;

Plot(EMA1, _DEFAULT_NAME(), ParamColor( "Color", colorCycle ),styleLine+styleNoTitle ); 
 
Pema2 = ParamField("Price field",-1);
Periodsema2 = Param("EMA 2 Periods", 15, 2, 300, 1, 10 );
EMA2 =  EMA( Pema2, Periodsema2 ) ;

Plot( EMA2, _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), styleLine+styleNoTitle ); 



_N(Title = EncodeColor(colorBlack) + StrFormat("{{NAME}} ({{INTERVAL}}), {{DATE}} ; {{OHLCX}}, V=%1.0f\n {{VALUES}}\n\n"+EncodeColor(colorBlue) + "EMA1 = " + EncodeColor(colorOrange)  + "( "+EMA1  + ") " , V));
 
_SECTION_END();


image

1 Like

Thanks @amsai for the sample code. I guess we need to manually color the text for each Plot I have, as you did. It's fine, just that need to do it every time I add new Plot into the chart.