Как EXPERT изменяет ввод от INDICADOR?

 
Как EXPERT изменяет ввод от INDICADOR?

input int Deviation = 12; // Зигзаг: Изменение цен в пуктах (Отклонение)

Мне нужно EXPERT, чтобы изменить это Deviation с запуском INDICATOR.

Как EXPERT может загрузить INDICATOR на графике?
 
Márcio Andrade:
Как EXPERT изменяет ввод от INDICADOR?

input int Deviation = 12; // Зигзаг: Изменение цен в пуктах (Отклонение)

Мне нужно EXPERT, чтобы изменить это Deviation с запуском INDICATOR.

Как EXPERT может загрузить INDICATOR на графике?

Уточните: эксперт должен брать данные с индикатора?

Пример в коде GoldWarrior02b:

входные параметры:

//--- input parameters
input double   InpLots           = 0.1;      // Lots
input ushort   InpStopLoss       = 100;      // Stop Loss (in pips)
input ushort   InpTakeProfit     = 150;      // Take Profit (in pips)
input ushort   InpTrailingStop   = 5;        // Trailing Stop (in pips)
input ushort   InpTrailingStep   = 5;        // Trailing Step (in pips)
input int      InpPeriod         = 21;       // Averaging period (for "Impulse" and "CCI")
input int      InpDepth          = 12;       // ZigZag: Depth
input int      InpDeviation      = 5;        // ZigZag: Deviation
input int      InpBackstep       = 3;        // ZigZag: Backstep
input double   InpProfitCloseAll = 300.0;    // Profit target for closing all positions
input bool     InpOutputInChart  = true;     // Output, "false" -> in "Experts", "true" -> in Chart
input int      InpInpulsSell     = -30;      // Negative impulse value for Sell signal
input int      InpInpulsBuy      = 30;       // Positive impulse value for Buy signal
input uchar    InpMultiplier     = 3;        // Multiplier of hedge positions of 1st and 2nd level

создание индикатора:

//--- create handle of the indicator iCustom
   handle_iCustom_ZZ=iCustom(m_symbol.Name(),Period(),"Examples\\ZigZag",InpDepth,InpDeviation,InpBackstep);
//--- if the handle is not created 
   if(handle_iCustom_ZZ==INVALID_HANDLE)
     {
      //--- tell about the failure and output the error code 
      PrintFormat("Failed to create handle of the iCustom (\"ZigZag\") indicator for the symbol %s/%s, error code %d",
                  m_symbol.Name(),
                  EnumToString(Period()),
                  GetLastError());
      //--- the indicator is stopped early 
      return(INIT_FAILED);
     }
 
Vladimir Karputov:

Уточните: эксперт должен брать данные с индикатора?

Пример в коде GoldWarrior02b:

входные параметры:

создание индикатора:

Мне нужно обратное, эксперт устанавливает входные параметры индикатора, запускает индикатор и отображает его на графике. Это возможно?

 
Márcio Andrade:

Мне нужно обратное, эксперт устанавливает входные параметры индикатора, запускает индикатор и отображает его на графике. Это возможно?

ChartIndicatorAdd

Пример: Custom Moving Average Levels.

Пример создания этого индикатора (он расположен в папке "каталог данных терминала"\MQL5\Indicators\MyInd\):

...
int            handle_iMA_Custom;            // variable for storing the handle of the iMA indicator 
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
...
//--- create handle of the Custom indicator "Custom Moving Average Levels"
   handle_iMA_Custom=iCustom(Symbol(),Period(),"MyInd\\Custom Moving Average Levels",
                             ma_period,
                             ma_shift,
                             ma_method,
                             100,
                             -100);
//--- if the handle is not created 
   if(handle_iMA_Custom==INVALID_HANDLE)
     {
      //--- tell about the failure and output the error code 
      PrintFormat("Failed to create handle of the iMA indicator for the symbol %s/%s, error code %d",
                  Symbol(),
                  EnumToString(Period()),
                  GetLastError());
      //--- the indicator is stopped early 
      return(INIT_FAILED);
     }
   ChartIndicatorAdd(0,0,handle_iMA_Custom);
//---
   return(INIT_SUCCEEDED);
  }
 
Vladimir Karputov:

ChartIndicatorAdd

Пример: Custom Moving Average Levels.

Пример создания этого индикатора (он расположен в папке "каталог данных терминала"\MQL5\Indicators\MyInd\):

Большое вам спасибо, ваш код очень хорош!

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