Changing the color of main chart RSI 14 display when it becomes OverBought or OverSold?

Shakir Elahi
1210
I have an MQL5 Mt4 indicator that displays RSI 14 reading on the main chart in white color. I want it to turn Green if the RSI is below 20 and red if it goes above 70. Can anyone help advise how to manage?

input string comfons2         =  "======RSI Settings======";                 //======RSI Settings======
input int    rsi_period_1     =  14;                                        //1st RSI Period
ENUM_APPLIED_PRICE               rsi_applied_price_1=PRICE_CLOSE;     //1st RSI Applied Price
input color  col_1            =  clrWhite;                                  //1st Color
input color  col_2            =  clrRed;                                    //2nd Color
input color  col_3            =  clrLime;                                  //3rd Color

//1st RSI Period
double get_rsi14(int _shift)
  {
   return(iRSI(NULL,0,rsi_period_1,rsi_applied_price_1,_shift));
  }

void show_info(int _shift=0)
  {
   write_line(23,"Rsi 14P:  "+DoubleToStr(get_rsi14(_shift),2),col_3,fontsize1,font1);
  }


I can add 

input double  OverBought         = 70;
input double  OverSold             = 30;


But how do I get the color to change?
Thanks.

Documentation on MQL5: Constants, Enumerations and Structures / Objects Constants / Web Colors
Documentation on MQL5: Constants, Enumerations and Structures / Objects Constants / Web Colors
  • www.mql5.com
Web Colors - Objects Constants - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Files:
RSI_Reading.zip  105 kb
William Roeder
26735
William Roeder  
Shakir Elahi: how do I get the color to change?
  1. MT4: Learn to code it.
    MT5: Begin learning to code it.

    If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into your code.

  2. or pay (Freelance) someone to code it. Top of every page is the link Freelance.
              Hiring to write script - General - MQL5 programming forum (2019)

    We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using CODE button) and state the nature of your problem.
              No free help (2017)

  3. Look in the CodeBase for a colored indicator, and learn how they use two separate buffers. If you assign to one color buffer, make the other color buffer(s) EMPTY_VALUE. Then connect to the previous bar.
              HOW CAN I hide CONNECTION lines of plots? (ttt) - MQL4 programming forum (2016)

Juvenille Emperor Limited
Moderator
22572
Use the </> button to insert your code next time.