Graphic overlay and label name overlay - page 2

 
Ryan L Johnson #:

To get help from others, you might want to post your code. I'm one of the few willing to engage in abstract discussions.

OK, I'll create a demo code and post it here , if you didn't understand the problem. That's the least of my problems and I'll have it done in a few minutes. But you should promise me that you will find a solution to exactly what I require, not keep giving me your suggestions that don't solve the problem at all. Or at least you should admit that you don't know any solution (even that would be more useful than what you've written so far). If you're not capable of that, I won't bother with the code, because any slightly more experienced MQL programmer should understand the problem, and beginners can't be expected to solve it.

 
Ryan L Johnson #:

To get help from others, you might want to post your code. I'm one of the few willing to engage in abstract discussions.

I decided to post the demo code so that no one can make excuses that they don't understand the problem and the problem is too abstract.

So there are two buffers in the indicator. And I require that the line be plotted at the bottom (so that it doesn't overplot the arrows), and that the name of the arrow buffer (in this case "Arrow", not "Line") appears in the info window (bubble) when you hover over the indicator.

I'm looking forward to a solution (from anyone), or confirmation that it can't be done (also from anyone).

#property indicator_chart_window

#property indicator_buffers   2
#property indicator_plots     2
#property indicator_color1    clrBlack
#property indicator_color2    clrLime
#property indicator_width1    2
#property indicator_width2    2
#property indicator_style1    STYLE_SOLID

//--- indicator buffers
double
   buffLine[],
   buffArrow[];

int OnInit(void)
  {
   //--- Name of indicator
   ::IndicatorSetString(INDICATOR_SHORTNAME, "Demo code for Ryan");
   //--- indicator digits
   ::IndicatorSetInteger(INDICATOR_DIGITS, _Digits);
   int
      arrowCode = 159,
      plotIndex = 0;
   //--- set buffers
   ::SetIndexBuffer(plotIndex, buffLine);
   ::PlotIndexSetInteger(plotIndex, PLOT_DRAW_TYPE, DRAW_LINE);
   ::PlotIndexSetDouble(plotIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
   ::PlotIndexSetInteger(plotIndex, PLOT_DRAW_BEGIN, 0);
   ::PlotIndexSetString(plotIndex, PLOT_LABEL, "Line");
   plotIndex++;
   ::SetIndexBuffer(plotIndex, buffArrow);
   ::PlotIndexSetInteger(plotIndex, PLOT_DRAW_TYPE, DRAW_ARROW);
   ::PlotIndexSetDouble(plotIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
   ::PlotIndexSetInteger(plotIndex, PLOT_DRAW_BEGIN, 0);
   ::PlotIndexSetString(plotIndex, PLOT_LABEL, "Arrow");
   ::PlotIndexSetInteger(plotIndex, PLOT_ARROW, arrowCode);
   //--- success
   return(INIT_SUCCEEDED);
  }

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[])
  {
   if(prev_calculated < 1)
     {
      ::ArrayInitialize(buffLine, EMPTY_VALUE);
      ::ArrayInitialize(buffArrow, EMPTY_VALUE);
     }
   //--- Main loop
   for(int i = prev_calculated; i < rates_total && !_StopFlag; i++)
      buffLine[i] = buffArrow[i] = (high[i] + low[i]) / 2.0;
   return(rates_total - 1);
  }

//+------------------------------------------------------------------+
 
Petr Nosek #:

I decided to post the demo code so that no one can make excuses that they don't understand the problem and the problem is too abstract.

So there are two buffers in the indicator. And I require that the line be plotted at the bottom (so that it doesn't overplot the arrows), and that the name of the arrow buffer (in this case "Arrow", not "Line") appears in the info window (bubble) when you hover over the indicator.

I'm looking forward to a solution (from anyone), or confirmation that it can't be done (also from anyone).

#property indicator_chart_window

#property indicator_buffers   2
#property indicator_plots     1
#property indicator_color1    clrLime
//#property indicator_color2    clrLime
#property indicator_width1    2
//#property indicator_width2    2
//#property indicator_style1    STYLE_SOLID

//--- indicator buffers
double
   buffLine[],
   buffArrow[];

int OnInit(void)
  {
   //--- Name of indicator
   IndicatorSetString(INDICATOR_SHORTNAME, "Demo code for Ryan");
   //--- indicator digits
   IndicatorSetInteger(INDICATOR_DIGITS, _Digits);
   
   int
      arrowCode = 159;
      //plotIndex = 0;
   //--- set buffers
   SetIndexBuffer(1, buffLine, INDICATOR_CALCULATIONS);
   //PlotIndexSetInteger(plotIndex, PLOT_DRAW_TYPE, DRAW_LINE);
   //PlotIndexSetDouble(plotIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
   //PlotIndexSetInteger(plotIndex, PLOT_DRAW_BEGIN, 0);
   //PlotIndexSetString(plotIndex, PLOT_LABEL, "Line");
   //plotIndex++;
   SetIndexBuffer(0, buffArrow,INDICATOR_DATA);
   PlotIndexSetInteger(0, PLOT_DRAW_TYPE, DRAW_ARROW);
   PlotIndexSetDouble(0, PLOT_EMPTY_VALUE, EMPTY_VALUE);
   PlotIndexSetInteger(0, PLOT_DRAW_BEGIN, 0);
   PlotIndexSetString(0, PLOT_LABEL, "Arrow");
   PlotIndexSetInteger(0, PLOT_ARROW, arrowCode);
   //--- success
   return(INIT_SUCCEEDED);
  }

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[])
  {
   if(prev_calculated < 1)
     {
      ArrayInitialize(buffLine, EMPTY_VALUE);
      ArrayInitialize(buffArrow, EMPTY_VALUE);
     }
   //--- Main loop
   for(int i = prev_calculated; i < rates_total && !_StopFlag; i++)
      buffLine[i] = buffArrow[i] = (high[i] + low[i]) / 2.0;
   return(rates_total - 1);
  }

//+------------------------------------------------------------------+
 
Ryan L Johnson #:

And where's the line on the chart? Sometimes it's easier to admit I don't have a solution.

Maybe it was still too abstract. So I need to plot the line and the arrows. The line needs to be at the bottom so it doesn't overplot the arrows. At the same time, the bubble needs to display the arrow buffer.

Is this still too abstract???

 
Petr Nosek #:

And where's the line on the chart? Sometimes it's easier to admit I don't have a solution.

Maybe it was still too abstract. So I need to plot the line and the arrows. The line needs to be at the bottom so it doesn't overplot the arrows. At the same time, the bubble needs to display the arrow buffer.

Is this still too abstract???

#property indicator_width1    2
#property indicator_width2    2
#property indicator_style1    STYLE_SOLID

//--- indicator buffers
double
   buffLine[],
   buffArrow[];

int OnInit(void)
  {
   //--- Name of indicator
   IndicatorSetString(INDICATOR_SHORTNAME, "Demo code for Ryan");
   //--- indicator digits
   IndicatorSetInteger(INDICATOR_DIGITS, _Digits);
   
   int
      arrowCode = 159;
      //plotIndex = 0;
   //--- set buffers
   SetIndexBuffer(1, buffLine, INDICATOR_DATA);
   PlotIndexSetInteger(1, PLOT_DRAW_TYPE, DRAW_LINE);
   PlotIndexSetDouble(1, PLOT_EMPTY_VALUE, EMPTY_VALUE);
   PlotIndexSetInteger(1, PLOT_DRAW_BEGIN, 0);
   PlotIndexSetString(1, PLOT_LABEL, "Line");
   //plotIndex++;
   SetIndexBuffer(0, buffArrow,INDICATOR_DATA);
   PlotIndexSetInteger(0, PLOT_DRAW_TYPE, DRAW_ARROW);
   PlotIndexSetDouble(0, PLOT_EMPTY_VALUE, EMPTY_VALUE);
   PlotIndexSetInteger(0, PLOT_DRAW_BEGIN, 0);
   PlotIndexSetString(0, PLOT_LABEL, "Arrow");
   PlotIndexSetInteger(0, PLOT_ARROW, arrowCode);
   //--- success
   return(INIT_SUCCEEDED);
  }

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[])
  {
   if(prev_calculated < 1)
     {
      ArrayInitialize(buffLine, EMPTY_VALUE);
      ArrayInitialize(buffArrow, EMPTY_VALUE);
     }
   //--- Main loop
   for(int i = prev_calculated; i < rates_total && !_StopFlag; i++)
      buffLine[i] = buffArrow[i] = (high[i] + low[i]) / 2.0;
   return(rates_total - 1);
  }

//+------------------------------------------------------------------+

test

I guess that I communicate better via code.😅
 
Ryan L Johnson #:


You're really funny. Or maybe it was still too abstract for you.

I'll leave aside the fact that your posted code doesn't work at all because it's missing an essential part. But I was able to complete the missing code. Unfortunately, you missed the point again. While your code now outputs the buffer values for the arrows to the bubble, the lines  overplots the arrow on the chart (see the picture), which was mentioned in my request as undesirable. Try again, you don't have many other options. And then don't forget to post that you don't know the solution and we can end this comedy.


 
Petr Nosek #:

You're really funny. Or maybe it was still too abstract for you.

I'll leave aside the fact that your posted code doesn't work at all because it's missing an essential part. But I was able to complete the missing code. Unfortunately, you missed the point again. While your code now outputs the buffer values for the arrows to the bubble, it also overplots the lines on the arrow graph (see the picture), which was mentioned in my request as undesirable. Try again, you don't have many other options. And then don't forget to post that you don't know the solution and we can end this comedy.


Charlie Brown is officially done trying to kick the football.

 
Ryan L Johnson #:

Charlie Brown is officially done trying to kick the football.

A good decision.

Since you didn't explicitly write that you don't know the solution, I have to ask you, where do you feel yourself to be in the graph below?


 
Petr Nosek #:

A good decision.

Since you didn't explicitly write that you don't know the solution, I have to ask you, where do you feel yourself to be in the graph below?


That remark having come from a guy who trades in Microsoft Paint🤦‍♂️...

Paint

No comment.

 
Ryan L Johnson #:

That remark having come from a guy who trades in Microsoft Paint🤦‍♂️...

No comment.

Don't worry at all about not knowing where you are on the Dunning-Kruger diagram. I have a pretty good idea about it, and I don't think I'm the only one.

Some might think that discussing programming problem with you was a waste of my time. But I don't think so. It's certain that you don't have the knowledge to be useful to help with programming, but you're a great entertainer.

Have a great day and I look forward to you making me laugh again sometime in the future.