Multiple Buttons in one indicator?

 

Currently to show the text I want, I need to make 2 buttons as there's a limit on the length in a button (as far as I know). 

#property version   "1.00"
#property strict
#property indicator_chart_window
#include <Controls/Button.mqh>
CButton SLTP;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
SLTP.Create(0,"SLTP",0,440,45,5,25);
SLTP.Text("M15: -10 close, -20 straight. If +20, move stop to +10. If +30");
SLTP.FontSize(8);
SLTP.Color(clrBlack);
SLTP.ColorBackground(clrBeige);
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//---
   
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
#property strict
#property indicator_chart_window
#include <Controls/Button.mqh>
CButton SLTP1;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
SLTP1.Create(0,"SLTP1",0,440,45,575,25);
SLTP1.Text("use KS close stop.");
SLTP1.FontSize(8);
SLTP1.Color(clrBlack);
SLTP1.ColorBackground(clrBeige);  
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//---
   
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+

When I put another "#include <..." in, and then put the rest of the code for the next button, it doesn't work. 

As I need 4 lines of similar length, I currently need 8 indicators...Surely there's a way to put all of them in one indicator? If so, can someone help?

 

You don't have to include anything if you just add the code at the bottom.

#property strict
#property indicator_chart_window
#include <Controls/Button.mqh>
CButton SLTP1;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
SLTP1.Create(0,"SLTP1",0,440,45,575,25);
SLTP1.Text("use KS close stop.");
SLTP1.FontSize(8);
SLTP1.Color(clrBlack);
SLTP1.ColorBackground(clrBeige);  
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//---
   
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
 
Marco vd Heijden:

You don't have to include anything if you just add the code at the bottom.

I don't get which bit of code you're referring to?

I want all buttons to show at once

 
Please go here: https://www.mql5.com/en/job
Trading applications for MetaTrader 5 to order
Trading applications for MetaTrader 5 to order
  • www.mql5.com
Hello developers.I need a working binary strategy. I want a strategy with expiry time between 15minutes and 1hour maximum. Please if you have a working strategy apply and if you have screenshots of profitability that will help.i will choose the best developer with a proven track record of profitability either withdrawal proof or trading...
 
Marco vd Heijden:
Please go here: https://www.mql5.com/en

I know how the freelance section works thanks, and I've used it multiple times. But not sure how that helps me learn to solve the problem myself...

 
Never mind, I've solved it anyway.
 

Then you could also tell us how you solved it.

Maybe someone who has a similar issue will hit this page by search engine in the future.

And he will wonder how you solved it.

 
Please go here: https://www.mql5.com/en/job
Trading applications for MetaTrader 5 to order
Trading applications for MetaTrader 5 to order
  • www.mql5.com
Hi,  Based on the indicator here https://www.mql5.com/en/job/91148 we need another addition to the indicator as below: Add a new column to the top right displaying the following values: - Daily, Weekly and Monthly: Long Time RSI Divergence and Short Time RSI Divergence Thanks! I need an ea that use pending orders (Buy stop & Sell stop) for...
 
Marco vd Heijden:
#include <Controls/Button.mqh>


You shouldn't be using controls/button for on-chart buttons because those are meant to be added to CAppDialog. Instead use CChartObjectButton from the chartobjects lib. 

 

There isn't any problem with it.

If you do not want to use libraries then you don't have to.

 
nicholi shen:


You shouldn't be using controls/button for on-chart buttons because those are meant to be added to CAppDialog. Instead use CChartObjectButton from the chartobjects lib. 

Would this solve the text limit problem? At the moment I need two buttons for one line...

Reason: