Vou escrever o indicador gratuitamente - página 103

 

Ajuda para encontrar um erro

Acrescentou dois amortecedores ao indicador, mas eles não aparecem no gráfico

//+------------------------------------------------------------------+
//|                                                   MTF_Moving.mq4 |
//|                        Copyright 2017, MetaQuotes Software Corp. |
//|                             https://www.mql5.com/ru/users/melnik |
//+------------------------------------------------------------------+
#property copyright "Copyright 2017, MetaQuotes Software Corp."
#property link      "https://www.mql5.com/ru/users/melnik"
#property version   "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_width1 2
#property indicator_width2 2
#property indicator_width3 2
#property indicator_width4 2
#property indicator_color1 Red
#property indicator_color2 Blue
#property indicator_color3 Black
#property indicator_color4 Black
#property indicator_type1 DRAW_LINE
#property indicator_type2 DRAW_LINE
#property indicator_type3 DRAW_LINE
#property indicator_type4 DRAW_LINE

double ma_buffer_slow[];
double ma_buffer_fast[];
double ma_buffer_s_01[];
double ma_buffer_s_02[];

//--- input parameters
input int                     PeriodMaSlow   =21;  //Period slow Ma
input int                     PeriodMaFast   =13;  //Pertiod fast Ma
input int                     Points         =50;  //Отклонение
input ENUM_APPLIED_PRICE      PriceMa        = 0;  //Applied price
input ENUM_MA_METHOD          MethodMa       = 0;  //Method Ma
input ENUM_TIMEFRAMES         Timeframe      =60;  //Timeframe for calculate

ENUM_TIMEFRAMES prd;

int index=-1;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   SetIndexBuffer(0, ma_buffer_slow, INDICATOR_DATA);
   SetIndexBuffer(1, ma_buffer_fast, INDICATOR_DATA);
   SetIndexBuffer(2, ma_buffer_s_01, INDICATOR_DATA);
   SetIndexBuffer(3, ma_buffer_s_02, INDICATOR_DATA);
//---
   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[])
  {
//---
   if((rates_total-prev_calculated-PeriodMaSlow)<=0)return(0);
  
   if(Period()>Timeframe) prd=PERIOD_CURRENT;
   if(Period()<=Timeframe) prd=prd=Timeframe;
  
   for(int i=rates_total-prev_calculated-PeriodMaSlow-1;i>=0;i--)
   {
      if(TimeMinute(time[i])==0)index=iBarShift(Symbol(), prd, time[i], false);
      
      ma_buffer_fast[i]=iMA(Symbol(), prd, PeriodMaFast, 0, MethodMa, PriceMa, index);
      ma_buffer_slow[i]=iMA(Symbol(), prd, PeriodMaSlow, 0, MethodMa, PriceMa, index);
      
      if(ma_buffer_fast[i+1]>=ma_buffer_slow[i+1] && ma_buffer_fast[i]<ma_buffer_slow[i])
      {ma_buffer_s_01[i]=ma_buffer_slow[i]+Points*Point;}
      
      if(ma_buffer_fast[i+1]<=ma_buffer_slow[i+1] && ma_buffer_fast[i]>ma_buffer_slow[i])
      {ma_buffer_s_02[i]=ma_buffer_slow[i]-Points*Point;}
   }
  
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
 
MakarFX:

Ajuda para encontrar um erro

Acrescentei dois amortecedores ao indicador, mas eles não são exibidos no gráfico

Eu tentei - mas consegui istohttps://www.mql5.com/ru/code/32179

Semaphore MAMA
Semaphore MAMA
  • www.mql5.com
Cигнальный Индикатор - при пересечении двух МА
 
SanAlex:

Eu tentei - mas consegui istohttps://www.mql5.com/ru/code/32179

Existe um para o MT4?
 
MakarFX:
Você tem um para mt4?

este também deve funcionar no mt4 - Vou verificar agora, se houver

--------------------

Vou tentar consertá-lo - o mt4 dá 6 erros

Snapshot.PNG

 
SanAlex:

este também deve funcionar no mt4 - Vou verificar agora, se houver

--------------------

Vou tentar consertá-lo - o mt4 dá 6 erros


Você pode olhar meu código, é mais fácil para mim descobri-lo. Eu não sou um programador.
 
MakarFX:
Você pode dar uma olhada no meu código, é mais fácil para mim descobri-lo. Eu não sou um programador.

Tentei descobrir seu código, mas ainda não descobri como fazer um Indicador de Sinal para mt4 e mt5 usando dois MAs.

https://www.mql5.com/ru/forum/356653#comment_19450441

Индикаторы: Semaphore MAMA
Индикаторы: Semaphore MAMA
  • 2020.11.27
  • www.mql5.com
Статьи и техническая библиотека по автоматическому трейдингу: Индикаторы: Semaphore MAMA
 
MakarFX:

Ajuda para encontrar um erro

Acrescentei dois amortecedores ao indicador, mas eles não são mostrados no gráfico

#indicador de propriedade_cor3 Preto
# indicador de propriedade_cor4 Preto

Mudar a cor - preto sobre preto não é muito agradável.

 
MakarFX:
Você pode olhar meu código, é mais fácil para mim descobri-lo. Eu não sou um programador.

Aqui está uma versão funcional - mas talvez você tenha algo mais em mente?

//+------------------------------------------------------------------+
//|                                                   MTF_Moving.mq4 |
//|                        Copyright 2017, MetaQuotes Software Corp. |
//|                             https://www.mql5.com/ru/users/melnik |
//+------------------------------------------------------------------+
#property copyright "Copyright 2017, MetaQuotes Software Corp."
#property link      "https://www.mql5.com/ru/users/melnik"
#property version   "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_width1 2
#property indicator_width2 2
#property indicator_width3 2
#property indicator_width4 2
#property indicator_color1 Wheat
#property indicator_color2 LightSeaGreen
#property indicator_color3 Red
#property indicator_color4 Blue
#property indicator_type1 DRAW_ARROW
#property indicator_type2 DRAW_ARROW
#property indicator_type3 DRAW_LINE
#property indicator_type4 DRAW_LINE

double ma_buffer_slow[];
double ma_buffer_fast[];
double ma_buffer_s_01[];
double ma_buffer_s_02[];

//--- input parameters
input int                     PeriodMaSlow   =21;  //Period slow Ma
input int                     PeriodMaFast   =13;  //Pertiod fast Ma
input ENUM_APPLIED_PRICE      PriceMa        = 0;  //Applied price
input ENUM_MA_METHOD          MethodMa       = 0;  //Method Ma
input ENUM_TIMEFRAMES         Timeframe      =60;  //Timeframe for calculate

ENUM_TIMEFRAMES prd;

int index=-1;
//--- right input parameters flag
bool flag_buy   = false;
bool flag_sell  = false;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
   string short_name;
   IndicatorDigits(Digits+1);
   IndicatorBuffers(4);
//--- indicator buffers mapping
   SetIndexBuffer(2, ma_buffer_slow, INDICATOR_DATA);
   SetIndexBuffer(3, ma_buffer_fast, INDICATOR_DATA);
   SetIndexBuffer(0, ma_buffer_s_01, INDICATOR_DATA);
   SetIndexBuffer(1, ma_buffer_s_02, INDICATOR_DATA);
//--- setting the indicator to be drawn as a line
   SetIndexStyle(0,DRAW_ARROW,EMPTY,2,clrWheat);
   SetIndexArrow(0,72);
   SetIndexBuffer(0,ma_buffer_s_01);
   SetIndexStyle(1,DRAW_ARROW,EMPTY,2,clrLightSeaGreen);
   SetIndexArrow(1,71);
   SetIndexBuffer(1,ma_buffer_s_02);
//--- setting the indicator to be drawn as a line
   SetIndexStyle(2,DRAW_LINE,EMPTY,2,clrRed);
   SetIndexBuffer(2,ma_buffer_slow);
   SetIndexStyle(3,DRAW_LINE,EMPTY,2,clrBlue);
   SetIndexBuffer(3,ma_buffer_fast);
//--- setting a name in the DataWindow window and a label
   short_name="MTF_Moving";
   IndicatorShortName(short_name);
   SetIndexLabel(0,short_name);
//---
   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[])
  {
//---
   if((rates_total-prev_calculated-PeriodMaSlow)<=0)
      return(0);
   if(Period()>Timeframe)
      prd=PERIOD_CURRENT;
   if(Period()<=Timeframe)
      prd=prd=Timeframe;
   for(int i=rates_total-prev_calculated-PeriodMaSlow-1; i>=0; i--)
     {
      if(TimeMinute(time[i])==0)
         index=iBarShift(Symbol(), prd, time[i], false);
      ma_buffer_fast[i]=iMA(Symbol(), prd, PeriodMaFast, 0, MethodMa, PriceMa, index);
      ma_buffer_slow[i]=iMA(Symbol(), prd, PeriodMaSlow, 0, MethodMa, PriceMa, index);
        {
         if(flag_sell==false)
            //--- check for short position (SELL) possibility
            if(ma_buffer_fast[i]>ma_buffer_slow[i])
              {
               ma_buffer_s_02[i]=Low[i];
               flag_buy=false;
               flag_sell=true;
              }
         if(flag_buy==false)
            //--- check for long position (BUY) possibility
            if(ma_buffer_fast[i]<ma_buffer_slow[i])
              {
               ma_buffer_s_01[i]=High[i];
               flag_buy=true;
               flag_sell=false;
              }
        }
     }
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+

--------------------------------------------------------

E os sinais do indicador estão chegando

rabotaet

 
como converter um indicador Stochastic-3 do mt 4 para mt 5
 

Meus cumprimentos à estimada comunidade!

Alguém pode escrever um indicador que exibe no gráfico as informações sobre o número de barras atual em um determinado período, que é especificado nas configurações. Por exemplo, o indicador é executado em dias, o período de relatório é de um mês especificado nas configurações. Isto significa que o indicador exibe no gráfico o número que, de acordo com a conta, é a barra de zero desde o início do mês civil. No MT4, por favor)

Boas festas para todos)

Feliz caçada)