Узнать значение МА, наложенной на RSI в подвале

 

Все желаю доброго утра!

Ребята, подскажите, есть ли возможность узнать значение МА, наложенной на RSI в подвале?

Заранее благодарен.


 

Попробуйте так:

Цикл по ChartIndicatorsTotal 

-> ChartIndicatorName

-> ChartIndicatorGet (получить хендл индикатора).

А по хендлу уже копировать данные.


Добавлено: сам я не проверял так, просто как идея.

 
Vladimir Karputov:

Попробуйте так:

Цикл по ChartIndicatorsTotal 

-> ChartIndicatorName

-> ChartIndicatorGet (получить хендл индикатора).

А по хендлу уже копировать данные.


Добавлено: сам я не проверял так, просто как идея.

Благодарю. А для МТ4 есть варианты?

 
iMAOnArray() разве не подходит?
 
Artyom Trishkin:
iMAOnArray() разве не подходит?

Хм.. Интересная мысль. Спасибо. Я и забыл про эти OnArray(), ни разу не пользовался....

 

Пример:

//+------------------------------------------------------------------+
//|                                         ChartIndicatorsTotal.mq5 |
//|                              Copyright © 2018, Vladimir Karputov |
//|                                           http://wmua.ru/slesar/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2018, Vladimir Karputov"
#property link      "http://wmua.ru/slesar/"
#property version   "1.001"
#property script_show_inputs
//--- input parameters
input bool  InpGetValues   = true;  // Get value buffer #0
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   int windows_total=(int)ChartGetInteger(0,CHART_WINDOWS_TOTAL);
   for(int i=windows_total-1; i>=0; i--)
     {
      int indicators_total=ChartIndicatorsTotal(0,i);
      for(int j=indicators_total-1; j>=0; j--)
        {
         Print("windows #",i,", indicator #",j,", ",ChartIndicatorName(0,i,j));
         if(InpGetValues)
           {
            int handle=ChartIndicatorGet(10,i,ChartIndicatorName(0,i,j));
            double buffer_0[];
            ArraySetAsSeries(buffer_0,true);
            int start_pos=0,count=3;
            if(iGetArray(handle,0,start_pos,count,buffer_0))
              {
               Print("   ->  ",DoubleToString(buffer_0[0],Digits()));
              }
           }
        }
     }
  }
//+------------------------------------------------------------------+
//| Get value of buffers                                             |
//+------------------------------------------------------------------+
bool iGetArray(const int handle,const int buffer,const int start_pos,
               const int count,double &arr_buffer[])
  {
   bool result=true;
   if(!ArrayIsDynamic(arr_buffer))
     {
      PrintFormat("ERROR! EA: %s, FUNCTION: %s, this a no dynamic array!",__FILE__,__FUNCTION__);
      return(false);
     }
   ArrayFree(arr_buffer);
//--- reset error code
   ResetLastError();
//--- fill a part of the iBands array with values from the indicator buffer
   int copied=CopyBuffer(handle,buffer,start_pos,count,arr_buffer);
   if(copied!=count)
     {
      //--- if the copying fails, tell the error code
      PrintFormat("ERROR! EA: %s, FUNCTION: %s, amount to copy: %d, copied: %d, error code %d",
                  __FILE__,__FUNCTION__,count,copied,GetLastError());
      //--- quit with zero result - it means that the indicator is considered as not calculated
      return(false);
     }
   return(result);
  }
//+------------------------------------------------------------------+

Результат:

2019.11.07 07:03:32.838 ChartIndicatorsTotal (GBPUSD,M1)        windows #2, indicator #0, MACD(15,26,1)
2019.11.07 07:03:32.839 ChartIndicatorsTotal (GBPUSD,M1)           ->  0.00001
2019.11.07 07:03:32.839 ChartIndicatorsTotal (GBPUSD,M1)        windows #1, indicator #1, MA(14)
2019.11.07 07:03:32.839 ChartIndicatorsTotal (GBPUSD,M1)           ->  55.20153
2019.11.07 07:03:32.839 ChartIndicatorsTotal (GBPUSD,M1)        windows #1, indicator #0, RSI(14)
2019.11.07 07:03:32.839 ChartIndicatorsTotal (GBPUSD,M1)           ->  46.59408
Файлы:
 
Evgeniy Zhdan:

Благодарю. А для МТ4 есть варианты?

Вы написали на форуме MQL5. Вы написали в главном разделе - поэтому ответ получили по MQL5. Вопросы для старого терминала пожалуйста размещайте в специальном разделе:  MQL4 и MetaTrader 4. Тему перенесу.

Причина обращения: