[Arquivo!] Escreverei gratuitamente a qualquer especialista ou indicador. - página 89

 
Vinin:
Não é mais fácil. Não há amortecedores suficientes.
Não haveria tampões suficientes. Mas o autor só queria histogramas :))
"Quero dizer 3 histogramas com valores diferentes"
 
granit77:
Não é bom o suficiente. Mas o autor só queria histogramas :))
"Quero dizer 3 histogramas com valores diferentes"

Então não é realista fazer 3 histogramas? Estou apenas perdendo meu tempo com o código?
 
Eu usei este como base. Não consigo descobrir como adicionar um terceiro histograma. Eu não sei o que fazer. Exceto ficar de pé sobre minha cabeça.
 
alkeon:
Então não é realista fazer 3 histogramas? Será que eu tive todo esse trabalho para quebrar o código por nada?
Nada é em vão. A experiência é mais valiosa do que o resultado.
Neste caso particular, depende do número de cópias MACD de que você precisa. Uma cópia requer dois buffers (histograma e linha de sinal), você precisa de oito buffers no total. Ou seja, três cópias levarão seis buffers e ainda terão algum sobrando.
Como está sua agonia? Onde está o código?

P.S.
Eu não gosto do seu protótipo. Não são dois MACDs, é um alisamento seqüencial. É melhor pegar um MACD clássico simples e triplicá-lo.
Arquivos anexados:
macd.mq4  3 kb
 
O principal bullying está no computador. Mas isso não é problema, eu já o atormentei tanto que posso lembrar de cor o que repetir.
 
É que é mais fácil (como eu pensava). Obrigado pelo indicador, agora vou começar a apanhar-lhe o jeito.
 

Aqui foi onde eu parei. Totalmente confuso sobre as fórmulas. O que está errado?

Esta é a versão mais recente, sem erros. Mas também é uma bagunça.

Arquivos anexados:
macd_3.mq4  5 kb
 
Em geral, a direção é correta, conserta os erros e funcionará. Não vou corrigi-lo, vou explicá-lo por palavras.

//+------------------------------------------------------------------+
//|                                                  Custom MACD.mq4 |
//|                      Copyright © 2004, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property  copyright "Copyright © 2004, MetaQuotes Software Corp."
#property  link      "http://www.metaquotes.net/"
//---- indicator settings
#property  indicator_separate_window
#property  indicator_buffers 6
#property  indicator_color1  Silver
#property  indicator_color2  Red
#property  indicator_color3  Silver
#property  indicator_color4  Red
#property  indicator_color5  Silver
#property  indicator_color6  Red
#property  indicator_width1  2
//---- indicator parameters
extern int FastEMA=12;
extern int SlowEMA=26;
extern int SignalSMA=9;
extern int FastEMA1=12;
extern int SlowEMA1=26;
extern int SignalSMA1=9;
extern int FastEMA2=12;
extern int SlowEMA2=26;
extern int SignalSMA2=9;
//---- indicator buffers
double     MacdBuffer[]; //Проверить соответствие нумерации
double     SignalBuffer[];
double     MacdBuffer1[];
double     SignalBuffer2[];
double     MacdBuffer3[];
double     SignalBuffer4[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- drawing settings
   SetIndexStyle(0,DRAW_HISTOGRAM);// нумерация буферов должна идти подряд от 0 до 6
   SetIndexStyle(1,DRAW_LINE);
   SetIndexDrawBegin(1,SignalSMA);
   IndicatorDigits(Digits+1);
    SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexDrawBegin(1,SignalSMA);
   IndicatorDigits(Digits+1);
    SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexDrawBegin(1,SignalSMA);
   IndicatorDigits(Digits+1);
//---- indicator buffers mapping
   SetIndexBuffer(0,MacdBuffer);
   SetIndexBuffer(1,SignalBuffer);
   SetIndexBuffer(0,MacdBuffer);
   SetIndexBuffer(1,SignalBuffer);
   SetIndexBuffer(0,MacdBuffer);
   SetIndexBuffer(1,SignalBuffer);
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("MACD("+FastEMA+","+SlowEMA+","+SignalSMA+","+FastEMA1+","+SlowEMA1+","+SignalSMA1+","+FastEMA2+","+SlowEMA2+","+SignalSMA2+")");
   SetIndexLabel(0,"MACD");
   SetIndexLabel(1,"Signal");
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| Moving Averages Convergence/Divergence                           |
//+------------------------------------------------------------------+
int start()
  {
   // Эта часть пишется только 1 раз
   int limit;
   int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
   //-------------------------------  
//---- macd counted in the 1-st buffer
   for(int i=0; i<limit; i++)
      MacdBuffer[i]=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);
//---- signal line counted in the 2-nd buffer
   for(i=0; i<limit; i++)
      SignalBuffer[i]=iMAOnArray(MacdBuffer,Bars,SignalSMA,0,MODE_SMA,i);
      
      
      int limit;
   int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
//---- macd counted in the 1-st buffer
   for(int i=0; i<limit; i++)
      MacdBuffer1[i]=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);
//---- signal line counted in the 2-nd buffer
   for(i=0; i<limit; i++)
      SignalBuffer2[i]=iMAOnArray(MacdBuffer,Bars,SignalSMA,0,MODE_SMA,i);
      
      
      int limit;
   int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
//---- macd counted in the 1-st buffer
   for(int i=0; i<limit; i++)
      MacdBuffer3[i]=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);
//---- signal line counted in the 2-nd buffer
   for(i=0; i<limit; i++)
      SignalBuffer4[i]=iMAOnArray(MacdBuffer,Bars,SignalSMA,0,MODE_SMA,i);
      
//---- done
   return(0);
  }
//+------------------------------------------------------------------+
 

Bom dia querido kubodel, por favor, corrija o conselheiro para abrir um negócio não às 00 minutos de cada período de tempo

e após 30 segundos a partir do início do período da vela

 
abolk:

ajustou os números tampão para uma primeira aproximação - depois é com você:

Andrey Nikolaevich, qual é a sua pressa! Ele mesmo o teria descoberto, mas teria se lembrado melhor.
Razão: