Hard problem: Arrows plotting on subwindow

 
Plotting arrows a long indicators' buffers on subwindow, which has more than one indicators, seems to be impossible to do it correctly since each indicator has its own scaling/zoom factor, and there is no way to retrieve that scale/zoom factor.

Simple code to try it out:
//+------------------------------------------------------------------+
//|                                                  test-buffer.mq5 |
//|                                  Copyright 2023, MetaQuotes Ltd. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2023, MetaQuotes Ltd."
#property link      "https://www.mql5.com"
#property version   "1.00"
#define PREFIX "_TEST_BUFFER"

// Add markers on buffer
void add_markers(int subwindow, int handle, int buffer_index, color clrMarker)
  {
   int total = 20;
   double buffer[];
   ArrayResize(buffer, total);
   ResetLastError();
   int n = CopyBuffer(handle, buffer_index, 0, total, buffer);
   if(n != total)
     {
      Print(" *** subwindow: ", subwindow, " buffer failed: ", buffer_index, " error:", GetLastError());
      return;
     }
   // skip forming candle
   for(int i = 1; i < total; i++)
     {
      datetime tstamp = iTime(_Symbol, PERIOD_CURRENT, i - 1);
      double price = buffer[total - i];
      string id = StringFormat("%s_%d_%d_%d_%d", PREFIX, subwindow, handle, buffer_index, i);
      ObjectCreate(0, id, OBJ_ARROW, subwindow, tstamp, price);
      ObjectSetInteger(0, id, OBJPROP_ARROWCODE, 251);
      ObjectSetInteger(0, id, OBJPROP_COLOR, clrMarker);
      ObjectSetInteger(0, id, OBJPROP_ANCHOR, ANCHOR_CENTER);
     }
     ChartRedraw(0);
  }

//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
   string name;
   int total;
// Remove all markers
   ObjectsDeleteAll(0, "");
// Remove all indicators
   int windows = (int) ChartGetInteger(0, CHART_WINDOWS_TOTAL);
   for(int w = windows - 1; w >= 0; w--)
     {
      total = ChartIndicatorsTotal(0, w);
      for(int i = total - 1; i >= 0; i--)
        {
         name = ChartIndicatorName(0, w, i);
         ChartIndicatorDelete(0, w, name);
        }
     }
   ChartSetInteger(0, CHART_MODE, CHART_LINE);
// Now add some indicators
   int handle1 = IndicatorCreate(_Symbol, PERIOD_CURRENT, IND_ALLIGATOR);
   ChartIndicatorAdd(0, 0, handle1);
   int handle2 = IndicatorCreate(_Symbol, PERIOD_CURRENT, IND_RSI);
   ChartIndicatorAdd(0, 1, handle2);
   int handle3 = IndicatorCreate(_Symbol, PERIOD_CURRENT, IND_ATR);
   ChartIndicatorAdd(0, 1, handle3);
   int handle4 = IndicatorCreate(_Symbol, PERIOD_CURRENT, IND_RVI);
   ChartIndicatorAdd(0, 2, handle4);
   int handle5 = IndicatorCreate(_Symbol, PERIOD_CURRENT, IND_RSI);
   ChartIndicatorAdd(0, 3, handle5);
   int handle6 = IndicatorCreate(_Symbol, PERIOD_CURRENT, IND_ATR);
   ChartIndicatorAdd(0, 4, handle6);
   
   // Now add some markers
   add_markers(0, handle1, 0, clrBlue);
   add_markers(0, handle1, 1, clrRed);
   add_markers(1, handle2, 0, clrSkyBlue);

   add_markers(1, handle3, 0, clrDarkCyan); // THIS FAILED !!!

   add_markers(2, handle4, 0, clrDarkCyan);
   add_markers(2, handle4, 1, clrRed);
   add_markers(3, handle5, 0, clrSkyBlue);
   add_markers(4, handle6, 0, clrSkyBlue);
   
   
   IndicatorRelease(handle1);
   IndicatorRelease(handle2);
   IndicatorRelease(handle3);
   IndicatorRelease(handle4);
   IndicatorRelease(handle5);
   IndicatorRelease(handle6);
   
  }
//+------------------------------------------------------------------+

Failed arrows

NOTE:  Failed plotted arrows of ATR's buffer.


Any hint of work around to plot the arrows is appreciated.
 
What is your goal?
 
do a matrix style display where each dot represents an indicator state
 
Conor Mcnamara #:
What is your goal?
plot specific arrows along data buffer on all indicators in every subwindows as shown in the example code.