코딩하는 방법? - 페이지 338

 
at120:
안녕 말든!

지원해주셔서 감사합니다! ;-)

심지어 당신이 나에게 말한 것처럼 코드를 작성할 때 :

(그렇게 생각해요...)

#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);

}

);

그래서 "First" 버전을 사용할 때 가치가 없습니다.

두 번째 버전을 사용할 때 오류가 발생합니다... 흠.

Mom1이 작동한다고 만 호출하십시오 ... 그러나 이것은 올바른 값이 아닙니다 ...

당신의 도움을 주셔서 감사합니다!

안녕, AT

"사용자 정의 이름" 을 표시기의 이름(기존 표시기)으로 바꾸고 iCustom() 호출에 매개변수를 추가하면 작동합니다. 그 이름은 단지 예로서 거기에 배치되었습니다

또한 버퍼 수를 정의하지 않았습니다(#property indicator_buffers를 사용하거나 IndicatorBuffers() 함수 를 사용하지 않음) 표시기는 버퍼가 0개 있다고 "생각"하고 해당 버그를 실제 크기로 초기화하지 않습니다. 사용할 버퍼의 수를 정의하십시오.

_______________________

 

안녕 믈라덴!

정보 감사합니다... 이미 완료했습니다... 코드는 다음과 같습니다.

#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);

}

);

대화의 오류는 여전히 있습니다 ...

당신의 도움을 주셔서 감사합니다!

안녕, AT

 
at120:
안녕 믈라덴!

정보 감사합니다... 이미 완료했습니다... 코드는 다음과 같습니다.

#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);

}

);

대화의 오류는 여전히 있습니다 ...

당신의 도움을 주셔서 감사합니다!

안녕, AT

컴파일러 오류가 없는 버전은 다음과 같습니다. _test.mq4

"myIndi"가 무엇인지 모르므로 iCustom()이 "myIndi" 표시기에서 값을 반환하는지 테스트할 수 없습니다.

파일:
copiler.gif  52 kb
_test.mq4  2 kb
 

안녕 믈라덴!

내 indi는 JMA.mq4 / JMA Indi의 일반 출력입니다.

또한 MA 출력 또는 다른 것이 될 수 있습니다. "myIndi"는 특별한 인디가 아닙니다.

그리고 인디의 호출은 일반 인디 창에서 작동합니다 ...

내 코드는 다음과 같습니다.

#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);

}

);

나는 내가 한 실패를 이해하지 못한다...

도와 주셔서 정말로 고맙습니다!!

안녕, AT

 

안녕 믈라덴!

이렇게 쓰거나 바꾸면..

나는 또한 대화 오류가 발생합니다 ... 어떤 아이디어 ..?

정말 감사합니다!

안녕, 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:
안녕 믈라덴!

이렇게 쓰거나 바꾸면..

나는 또한 대화 오류가 발생합니다 ... 어떤 아이디어 ..?

정말 감사합니다!

안녕, 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시에

예상 매개변수const double[] 이라고 가정할 때 double 로 진화하는 요소를 사용할 수 없습니다. "mom1"을 사용하는 대신 "mom1"을 사용하십시오.

 

안녕 믈라덴!

답변 주셔서 감사합니다. 이제 내 질문은 내 이중을 내 const 이중 시리즈[]로 "변환"하는 방법입니다.

왜냐하면 내가 mom1 만 사용할 때 "0"이 출력으로 나오기 때문입니다 ...

그래서 어떻게 mom1을 Close처럼 "보이게" 만들 수 있습니까? 이에 대한 샘플 코드가 있습니까?

감사합니다. AT

 
at120:
안녕 믈라덴!

답변 주셔서 감사합니다. 이제 내 질문은 내 이중을 내 const 이중 시리즈[]로 "변환"하는 방법입니다.

왜냐하면 내가 mom1 만 사용할 때 "0"이 출력으로 나오기 때문입니다 ...

그래서 어떻게 mom1을 Close처럼 "보이게" 만들 수 있습니까? 이에 대한 샘플 코드가 있습니까?

감사합니다. AT

아무것도 "변환"할 필요가 없습니다. "" 부분이 제거되는 순간 적절한 매개변수가 "됩니다"

차트에서는 다음과 같이 표시됩니다.

그리고 여기 코드가 있습니다: _test_2.mq4

파일:
_test_2.mq4  1 kb
test.gif  64 kb
 

안녕 믈라덴!

이제 그것은 나를 위해 작동합니다. IndicatorBuffers(2)를 잊어버린 것 같습니다.

이제 올바른 값을 얻은 것 같습니다!

도와 주셔서 정말로 고맙습니다!!

안녕, AT

 

함수 매개변수에서 어떤 배열을 const로 선언해야 합니까?

사유: