[Arşiv!] Herhangi bir uzman veya göstergeyi ücretsiz yazacağım. - sayfa 89

 
Vinin :
Daha kolay değil. Yeterli arabellek yok
Yetmedi. Ancak yazar sadece histogramları istedi :))
"Farklı değerlere sahip 3 histogram olacağını kastediyorum"
 
granit77 :
Yetmedi. Ancak yazar sadece histogramları istedi :))
"Farklı değerlere sahip 3 histogram olacağını kastediyorum"

Peki gerçekten 3 histogram yapmamak ne anlama geliyor? Kodun tecavüzüne sadece boşuna mı katlandım?
 
İşte bunun temeli. Ve üçüncü bir histogramın nasıl ekleneceğini anlamıyorum. Ne yapmadı. Kafasında olmadığı sürece.
 
alkeon :
Peki gerçekten 3 histogram yapmamak ne anlama geliyor? Kodun tecavüzüne sadece boşuna mı katlandım?
Boşuna hiçbir şey olmuyor. Deneyim sonuçlardan daha değerlidir.
Bu özel durumda, hepsi ihtiyacınız olan MACD kopyalarının sayısına bağlıdır. Bir kopya iki tampon (histogram ve sinyal hattı ), toplamda sekiz tampon gerektirir. Yani, üç kopya altı arabellek alacak ve hala kalacaktır.
Acıların nasıl? Kod nerede?

not
Prototipinizi beğenmedim. İki MACD değil, sıralı yumuşatma vardır. Basit bir klasik MACD alıp üçe katlasan iyi olur.
Dosyalar:
macd.mq4  3 kb
 
Asıl zorbalık iş başında bilgisayarda yatıyor. Ama bu bir sorun değil, ona o kadar çok eziyet ettim ki ne tekrar edeceğimi ezbere hatırlıyorum.
 
Programlamadığım gibi, daha basit olandan geldim (düşündüğüm gibi). Gösterge için teşekkürler, şimdi bununla fırfırlar başlayacağım.
 

İşte burada durdu. Formüllerle tamamen karıştı. Sorun nedir?

Bu, hatasız en son sürümdür. Ama aynı saçmalık.

Dosyalar:
macd_3.mq4  5 kb
 
Genel olarak, yön doğrudur, hataları düzeltin ve işe yarayacaktır. Düzenleme yapmayacağım, kelimelerle açıklayacağım.

 //+------------------------------------------------------------------+
//|                                                  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 );
  }
//+------------------------------------------------------------------+
 

iyi günler, sevgili kubodel, lütfen danışmanı düzeltin, böylece her zaman diliminde 00 dakikasında bir anlaşma açılmaz

ve zaman çerçevesi mumunun başlangıcından 30 saniye sonra

 
abolk :

ilk yaklaşımdaki arabellek numaralarını düzelttim - ayrıca - kendim:

Andrei Nikolaevich, acelen nerede! Bunu kendisi çözebilirdi, ama daha iyi hatırlardı.