Australian (ASX) Stock Market Forum

Amibroker multi text column - color

Joined
7 June 2007
Posts
28
Reactions
0
Hi all,
Is it possible to "colour" the exploration column below? I can colour a regular addcolumn but not so much the multitextcolumn...any comments appreciated.

TextList3 = "\n Up \n Down";
TextSelector3 = 1 * xaoup + 2 * NOT xaoup ;
AddMultiTextColumn(TextSelector3, TextList3, "All Market Trend" );

Thanks in advance...Steve C
 
Try this for starters
my code colours the system column as per below. You could then tweek it to suit your needs in your code

AddMultiTextColumn( TextSelector, TextList, "System", 1, colorwhite, colorGreen, 80 );

upload_2019-11-24_6-34-18.png
 
Try this for starters
my code colours the system column as per below. You could then tweek it to suit your needs in your code

AddMultiTextColumn( TextSelector, TextList, "System", 1, colorwhite, colorGreen, 80 );

View attachment 98726

Awesome, thank you.
Out of interest, what if I wanted to colour according to the text content? So if text is "x" one colour background, if text is "y" then another colour? Can this be done?
TIA
 
Awesome, thank you.
Out of interest, what if I wanted to colour according to the text content? So if text is "x" one colour background, if text is "y" then another colour? Can this be done?
TIA

It definitely is. I happened to spend last night working this out and coding my exploration for this.

Code:
AddMultiTextColumn(bs_sig, "\n BUY \n SELL \n STALE", "BUY|SELL|STALE", 1.2, colorDefault,IIf(b == True, colorBrightGreen, IIF(s == True, colorRed, IIf(st == True, colorGold, colorDefault))));

I use bs_sig to determine the text to be chosen. bs_sig is an IIF statement to assign these variables bs_sig = IIf(b, 1, IIf(s, 2, IIf(st, 3, 0)));

You can see later in the code above that I use another IIF statement for the background colour. I am finding IIF statements very useful lately. for the bg colour, it is as follows:

IFF(boolean condition, this colour if true, if false run this IFF (boolean condition, this colour if true, if false run this IFF (boolean condition, this colour if true, if false 0)));

And here is another 1 I wrote.

Code:
In_UP = Exit_Percent == 40;
In_DOWN = Exit_Percent == 10;
exit_sig = IIf(In_UP, 1, IIf(In_DOWN, 2, 0));
AddMultiTextColumn(exit_sig, "\n   UP   \n   DOWN", "Index Direction", 1.2, colorDefault,IIf(Exit_Percent == 40, colorBrightGreen, colorRed), -1);

I'm not the best coder so it probably could have been written better.
 
It definitely is. I happened to spend last night working this out and coding my exploration for this.

Code:
AddMultiTextColumn(bs_sig, "\n BUY \n SELL \n STALE", "BUY|SELL|STALE", 1.2, colorDefault,IIf(b == True, colorBrightGreen, IIF(s == True, colorRed, IIf(st == True, colorGold, colorDefault))));

I use bs_sig to determine the text to be chosen. bs_sig is an IIF statement to assign these variables bs_sig = IIf(b, 1, IIf(s, 2, IIf(st, 3, 0)));

You can see later in the code above that I use another IIF statement for the background colour. I am finding IIF statements very useful lately. for the bg colour, it is as follows:

IFF(boolean condition, this colour if true, if false run this IFF (boolean condition, this colour if true, if false run this IFF (boolean condition, this colour if true, if false 0)));

And here is another 1 I wrote.

Code:
In_UP = Exit_Percent == 40;
In_DOWN = Exit_Percent == 10;
exit_sig = IIf(In_UP, 1, IIf(In_DOWN, 2, 0));
AddMultiTextColumn(exit_sig, "\n   UP   \n   DOWN", "Index Direction", 1.2, colorDefault,IIf(Exit_Percent == 40, colorBrightGreen, colorRed), -1);

I'm not the best coder so it probably could have been written better.
Hey,
Thanks, we are all learning I guess. Just happy to get an answer to work with....very cool. Will give it a try.
 
Awesome, thank you.
Out of interest, what if I wanted to colour according to the text content? So if text is "x" one colour background, if text is "y" then another colour? Can this be done?
TIA

so to continue with your example a simple way could be like this ( this is a bit tricky without your code but I'm sure you could work it out)

AddMultiTextColumn(TextSelector3, TextList3, "All Market Trend", 1,IIf( Up, colorWhite, IIf( Down, colorRed, colordefault )),colorGreen, 80 );
 
Hey Trav
Tried code as below...see error 29...??
View attachment 98741
This means it hasn't been initialized. That is, created. Trav used variables that you don't have to demonstrate how it works.

In trav's example. If the variable UP is true then it's white, if Down is true then red, otherwise green. So you now need to create a variable UP that will hold the value of whether UP is true or false. Or substitute for your own variable if you have already done that.
 
This means it hasn't been initialized. That is, created. Trav used variables that you don't have to demonstrate how it works.

In trav's example. If the variable UP is true then it's white, if Down is true then red, otherwise green. So you now need to create a variable UP that will hold the value of whether UP is true or false. Or substitute for your own variable if you have already done that.
Got it, done and working...thanks heaps from a newbie...really appreciated everyone.
 
All good. Hope it helps. Once you understand the logic of the IIF, things become easier as it's useful.
 
Top