• Australian (ASX) Stock Market Forum

Hello and welcome to Aussie Stock Forums!

To gain full access you must register. Registration is free and takes only a few seconds to complete.

Already a member? Log in here.

Amibroker multi text column - color

Discussion in 'Trading Strategies/Systems' started by stevecar144, Nov 21, 2019.

sentifi.com

Aussie Stock Forum Sentifi Top themes and market attention on:

  1. stevecar144

    stevecar144

    Posts:
    26
    Likes Received:
    0
    Joined:
    Jun 7, 2007
    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
     
  2. Trav.

    Trav.

    Posts:
    438
    Likes Received:
    426
    Joined:
    Nov 27, 2017
    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
     
    Newt and debtfree like this.
  3. stevecar144

    stevecar144

    Posts:
    26
    Likes Received:
    0
    Joined:
    Jun 7, 2007
    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
     
  4. Warr87

    Warr87

    Posts:
    68
    Likes Received:
    95
    Joined:
    Jun 28, 2019
    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.
     
  5. stevecar144

    stevecar144

    Posts:
    26
    Likes Received:
    0
    Joined:
    Jun 7, 2007
    Hey,
    Thanks, we are all learning I guess. Just happy to get an answer to work with....very cool. Will give it a try.
     
  6. Trav.

    Trav.

    Posts:
    438
    Likes Received:
    426
    Joined:
    Nov 27, 2017
    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 );
     
    debtfree likes this.
  7. stevecar144

    stevecar144

    Posts:
    26
    Likes Received:
    0
    Joined:
    Jun 7, 2007
    Hey Trav
    Tried code as below...see error 29...??
    upload_2019-11-25_8-20-20.png
     
  8. Warr87

    Warr87

    Posts:
    68
    Likes Received:
    95
    Joined:
    Jun 28, 2019
    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.
     
    Trav. and debtfree like this.
  9. stevecar144

    stevecar144

    Posts:
    26
    Likes Received:
    0
    Joined:
    Jun 7, 2007
    Got it, done and working...thanks heaps from a newbie...really appreciated everyone.
     
  10. Warr87

    Warr87

    Posts:
    68
    Likes Received:
    95
    Joined:
    Jun 28, 2019
    All good. Hope it helps. Once you understand the logic of the IIF, things become easier as it's useful.
     
Loading...

Share This Page