Nasıl kodlanır? - sayfa 338

 
at120:
Merhaba Malden!

Desteğin için teşekkürler! ;-)

Hatta, bana söylediğin gibi kodu yazdığımda:

(Bence de...)

#property indicator_chart_window

double buffer[];

double mom1[];

int init() { SetIndexBuffer(0,buffer); SetIndexBuffer(1,mom1);return(0); }

int deinit() { return(0); }

int start()

{

int counted_bars=IndicatorCounted();

if(counted_bars<0) return(-1);

if(counted_bars>0) counted_bars--;

int limit = MathMin(Bars-counted_bars,Bars-1);

for(int i = limit; i>=0; i--)

{

mom1 = iCustom(NULL,0,"custom name",0,i);

buffer = (

Mom(mom1,10,Bars,i);

//doesn't work - no value in indi

// Mom(mom1,10,Bars,i); //error: parameter conversation not allowed

// mom1 // this works

);

}

return(0);

}

double Mom(const double& series[], int period, int totcount, int index)

{

if (totcount<1 || period<1) return (EMPTY_VALUE);

if (indextotcount-1) return (EMPTY_VALUE);

return (series-series);

}

);

Yani "İlk" sürümü kullandığımda hiçbir değer almıyorum..

İkinci sürümü kullandığımda hata alıyorum... hmmm.

Sadece anneyi çağır1 çalışır... ama bu doğru değer değil...

Yardımın için teşekkürler!

hoşçakal, AT

"Özel adı" göstergenizin adıyla değiştirin (mevcut gösterge), iCustom() çağrısına parametreler ekleyin ve çalışacaktır. O isim oraya sadece bir örnek olarak yerleştirildi.

Ayrıca, arabellek sayısını tanımlamadınız (#property gösterge_buffers kullanarak veya IndicatorBuffers() işlevini kullanarak değil) Gösterge, 0 arabellek olduğunu "düşünür" ve bu engelleyicileri hiçbir zaman gerçek boyutuna başlatmaz. Kullanacağınız tampon sayısını tanımlayın

________________________

 

Merhaba Mladen!

Bilgileriniz için teşekkürler... Bunu zaten yaptım... Kod şöyle görünüyor:

#property indicator_separate_window

#property indicator_color3 Red

#property indicator_width1 3

#property indicator_buffers 3

#property indicator_color1 LawnGreen

#property indicator_color2 Red

#include // here the mom() function is incl.

double buffer[];

double mom1[];

int init() { SetIndexBuffer(0,buffer); SetIndexBuffer(1,mom1);return(0); }

int deinit() { return(0); }

int start()

{

int counted_bars=IndicatorCounted();

if(counted_bars<0) return(-1);

if(counted_bars>0) counted_bars--;

int limit = MathMin(Bars-counted_bars,Bars-1);

for(int i = limit; i>=0; i--)

{

mom1 = iCustom(NULL,0,"myIndi",0,i);

buffer = (

Mom(mom1,10,Bars,i); //doesn't work - no value in indi

// Mom(mom1,10,Bars,i); //error: parameter conversation not allowed

// mom1 // this works, but no subfunction incl.

);

}

return(0);

}

//normaly in mqh incl.

double Mom(const double& series[], int period, int totcount, int index)

{

if (totcount<1 || period<1) return (EMPTY_VALUE);

if (indextotcount-1) return (EMPTY_VALUE);

return (series-series);

}

);

Konuşma hatası hala orada...

Yardımın için teşekkürler!

hoşçakal, AT

 
at120:
Merhaba Mladen!

Bilgileriniz için teşekkürler... Bunu zaten yaptım... Kod şöyle görünüyor:

#property indicator_separate_window

#property indicator_color3 Red

#property indicator_width1 3

#property indicator_buffers 3

#property indicator_color1 LawnGreen

#property indicator_color2 Red

#include // here the mom() function is incl.

double buffer[];

double mom1[];

int init() { SetIndexBuffer(0,buffer); SetIndexBuffer(1,mom1);return(0); }

int deinit() { return(0); }

int start()

{

int counted_bars=IndicatorCounted();

if(counted_bars<0) return(-1);

if(counted_bars>0) counted_bars--;

int limit = MathMin(Bars-counted_bars,Bars-1);

for(int i = limit; i>=0; i--)

{

mom1 = iCustom(NULL,0,"myIndi",0,i);

buffer = (

Mom(mom1,10,Bars,i); //doesn't work - no value in indi

// Mom(mom1,10,Bars,i); //error: parameter conversation not allowed

// mom1 // this works, but no subfunction incl.

);

}

return(0);

}

//normaly in mqh incl.

double Mom(const double& series[], int period, int totcount, int index)

{

if (totcount<1 || period<1) return (EMPTY_VALUE);

if (indextotcount-1) return (EMPTY_VALUE);

return (series-series);

}

);

Konuşma hatası hala orada...

Yardımın için teşekkürler!

hoşçakal, AT

Derleyici hatası olmayan bir sürüm: _test.mq4

"myIndi"nin ne olduğu hakkında hiçbir fikriniz yok, bu nedenle iCustom() öğesinin "myIndi" göstergenizden değerler döndürüp döndürmediğini test edemediniz

Dosyalar:
copiler.gif  52 kb
_test.mq4  2 kb
 

Merhaba Mladen!

Benim indi'm, JMA.mq4 / JMA Indi'den alınan normal bir çıktıdır.

Ayrıca bir MA çıktısı veya başka bir şey olabilir. "myIndi" özel bir Hintçe değildir.

Ve indi'nin çağrısı normal indi penceresinde çalışır ...

Kodum şöyle görünüyor:

#property indicator_separate_window

#property indicator_color3 Red

#property indicator_width1 3

#property indicator_buffers 3

#property indicator_color1 LawnGreen

#property indicator_color2 Red

#include // here the mom() function is incl.

double buffer[];

double mom1[];

int init() { SetIndexBuffer(0,buffer); SetIndexBuffer(1,mom1);return(0); }

int deinit() { return(0); }

int start()

{

int counted_bars=IndicatorCounted();

if(counted_bars<0) return(-1);

if(counted_bars>0) counted_bars--;

int limit = MathMin(Bars-counted_bars,Bars-1);

for(int i = limit; i>=0; i--)

{

mom1 = iCustom(NULL,0,"JMA",0,i); //normal JMA / MA output

// I get this out put, and it's ok, but the second output (buffer) is zero...

buffer = (

Mom(mom1,10,Bars,i); //no compiler error, but doesn't work - no value in indi window

// Mom(mom1,10,Bars,i); //error: parameter conversation not allowed

// mom1 // this works, but it's the value i want

);

}

return(0);

}

//normaly in mqh incl.

double Mom(const double& series[], int period, int totcount, int index)

{

if (totcount<1 || period<1) return (EMPTY_VALUE);

if (indextotcount-1) return (EMPTY_VALUE);

return (series-series);

}

);

Yaptığım başarısızlığı anlamıyorum...

Yardımın için çok teşekkürler!!

hoşçakal, AT

 

Merhaba Mladen!

Böyle yazdığımda veya değiştirdiğimde...

Ayrıca konuşma hatası alıyorum... herhangi bir fikir ..?

Çok teşekkürler!

hoşçakal, AT

#property indicator_separate_window

#property indicator_color3 Red

#property indicator_width1 3

#property indicator_buffers 3

#property indicator_color1 LawnGreen

#property indicator_color2 Red

//#include // here the mom() function is incl.

double buffer[];

double mom1[];

int init() { SetIndexBuffer(0,buffer); SetIndexBuffer(1,mom1);return(0); }

//normaly in mqh incl.

double Mom(const double& series[], int period, int totcount, int index)

{

if (totcount<1 || period<1) return (EMPTY_VALUE);

if (indextotcount-1) return (EMPTY_VALUE);

return (series-series);

}

int deinit() { return(0); }

int start()

{

int counted_bars=IndicatorCounted();

if(counted_bars<0) return(-1);

if(counted_bars>0) counted_bars--;

int limit = MathMin(Bars-counted_bars,Bars-1);

for(int i = limit; i>=0; i--)

{

mom1 = iMA(Symbol(),Period(),13,8,MODE_SMMA,PRICE_MEDIAN,i); //normal JMA / MA output

// I get this out put, and it's ok, but the second output (buffer) is zero...

buffer = (

// Mom(mom1,10,Bars,i) //no compiler error, but doesn't work - no value in indi window

Mom(mom1,10,Bars,i) //error: parameter conversation not allowed

// mom1 // this works, but it is NOT the value i want

);

}

return(0);

}

 
at120:
Merhaba Mladen!

Böyle yazdığımda veya değiştirdiğimde...

Ayrıca konuşma hatası alıyorum... herhangi bir fikir ..?

Çok teşekkürler!

hoşçakal, AT

#property indicator_separate_window

#property indicator_color3 Red

#property indicator_width1 3

#property indicator_buffers 3

#property indicator_color1 LawnGreen

#property indicator_color2 Red

//#include // here the mom() function is incl.

double buffer[];

double mom1[];

int init() { SetIndexBuffer(0,buffer); SetIndexBuffer(1,mom1);return(0); }

//normaly in mqh incl.

double Mom(const double& series[], int period, int totcount, int index)

{

if (totcount<1 || period<1) return (EMPTY_VALUE);

if (indextotcount-1) return (EMPTY_VALUE);

return (series-series);

}

int deinit() { return(0); }

int start()

{

int counted_bars=IndicatorCounted();

if(counted_bars<0) return(-1);

if(counted_bars>0) counted_bars--;

int limit = MathMin(Bars-counted_bars,Bars-1);

for(int i = limit; i>=0; i--)

{

mom1 = iMA(Symbol(),Period(),13,8,MODE_SMMA,PRICE_MEDIAN,i); //normal JMA / MA output

// I get this out put, and it's ok, but the second output (buffer) is zero...

buffer = (

// Mom(mom1,10,Bars,i) //no compiler error, but doesn't work - no value in indi window

Mom(mom1,10,Bars,i) //error: parameter conversation not allowed

// mom1 // this works, but it is NOT the value i want

);

}

return(0);

}

120'de

Beklenen parametrenin const double [] olması gerektiğinde ikiye katlanan bir öğe kullanamazsınız. "mom1" yerine "mom1" kullanın

 

Merhaba Mladen!

Cevabınız için teşekkürler, şimdi sorum şu, dublemi const double serime nasıl "dönüştürebilirim"[]

çünkü mom1'i kullandığımda çıktı olarak sadece "0" alıyorum ...

Öyleyse, mom1'in "gibi görünmesini" nasıl sağlayabilirim, örneğin, Kapat. Bunun için herhangi bir örnek kod var mı?

Çok teşekkürler ve hoşçakal, AT

 
at120:
Merhaba Mladen!

Cevabınız için teşekkürler, şimdi sorum şu, dublemi const double serime nasıl "dönüştürebilirim"[]

çünkü mom1'i kullandığımda çıktı olarak sadece "0" alıyorum ...

Öyleyse, mom1'in "gibi görünmesini" nasıl sağlayabilirim, örneğin, Kapat. Bunun için herhangi bir örnek kod var mı?

Çok teşekkürler ve hoşçakalın, AT

Hiçbir şeyi "dönüştürmenize" gerek yoktur. "" parçasının kaldırıldığı an, uygun parametre "olur"

İşte grafikte nasıl göründüğü:

Ve işte kod: _test_2.mq4

Dosyalar:
_test_2.mq4  1 kb
test.gif  64 kb
 

Merhaba Mladen!

Şimdi benim için çalışıyor, Görünüşe göre IndicatorBuffers(2)'yi unutmuşum;

Şimdi doğru değeri aldığım anlaşılıyor!

Yardımın için çok teşekkürler!!

hoşçakal, AT

 

İşlev parametrelerinde hangi dizilerin const olarak bildirilmesi gerekir?

Neden: