MQL4 및 MQL5에 대한 초보자 질문, 알고리즘 및 코드에 대한 도움말 및 토론 - 페이지 9 12345678910111213141516...1953 새 코멘트 Dmitry Fedoseev 2016.11.15 11:54 #81 -Aleks- : 이해하려고 합니다. 저것들. 당신이 생각하는 올바른 옵션은 SVA_03, 맞습니까? 예, 아마도. 하지만 _02는 확실히 틀렸습니다. Aleksey Vyazmikin 2016.11.15 12:44 #82 Dmitry Fedoseev : 예, 아마도. 하지만 _02는 확실히 틀렸습니다. 흠.. 내 자신에게서 한 가지 실수를 발견했다. 이제 거의 불일치가 없어. 여기가 원본입니다. //+------------------------------------------------------------------+ //| SVA_04.mq4 | //| Copyright © 2006, MetaQuotes Software Corp. | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "Copyright © 2004, MetaQuotes Software Corp." #property link "http://www.metaquotes.net/" #property strict #property indicator_chart_window #property indicator_buffers 3 #property indicator_color1 Yellow //---- input parameters extern int RSIPeriod= 14 ; extern int Levl= 50 ; extern int TF= 0 ; //---- buffers double MABuffer[]; double PosBuffer[]; double NegBuffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { string short_name; IndicatorBuffers ( 1 ); SetIndexBuffer ( 0 ,MABuffer); SetIndexBuffer ( 1 ,PosBuffer); SetIndexBuffer ( 2 ,NegBuffer); //---- indicator line SetIndexStyle ( 0 , DRAW_LINE ); //---- //---- name for DataWindow and indicator subwindow label // short_name="RSI("+IntegerToString(RSIPeriod)+")"; short_name= "RSI(" +RSIPeriod+ ")" ; IndicatorShortName (short_name); SetIndexLabel ( 0 ,short_name); SetIndexLabel ( 1 , "U" ); SetIndexLabel ( 2 , "D" ); return ( 0 ); } //+------------------------------------------------------------------+ //| Relative Strength Index | //+------------------------------------------------------------------+ int start() { int i,counted_bars= IndicatorCounted (); double rel,negative,positive,sma,x,y,Pos,Neg; //---- if ( Bars <=RSIPeriod) return ( 0 ); if (TF!= 0 ) { string name= WindowExpertName (); for (i= 0 ; i< Bars -counted_bars+ 1 ; i++) { int barIndex= iBarShift ( NULL ,TF, Time [i], false ); MABuffer[i]= iCustom ( Symbol (),TF,name,RSIPeriod,Levl, 0 , 0 ,barIndex); } return ( 0 ); } i= Bars -RSIPeriod- 1 ; if (counted_bars>=RSIPeriod) i= Bars -counted_bars- 1 ; while (i>= 0 ) { double sumn= 0.0 ,sump= 0.0 ; if (i== Bars -RSIPeriod- 1 ) { int k= Bars - 2 ; //---- initial accumulation while (k>=i) { rel= Close [k]- Close [k+ 1 ]; if (rel> 0 ) sump+=rel; else sumn-=rel; k--; } positive=sump/RSIPeriod; negative=sumn/RSIPeriod; } else { //---- smoothed moving average rel= Close [i]- Close [i+ 1 ]; if (rel> 0 ) sump=rel; else sumn=-rel; positive=(PosBuffer[i+ 1 ]*(RSIPeriod- 1 )+sump)/RSIPeriod; negative=(NegBuffer[i+ 1 ]*(RSIPeriod- 1 )+sumn)/RSIPeriod; } PosBuffer[i]=positive; NegBuffer[i]=negative; i--; } i= Bars -RSIPeriod- 1 ; if (counted_bars>=RSIPeriod) i= Bars -counted_bars- 1 ; while (i>= 0 ) { x=PosBuffer[i+ 1 ]; y=NegBuffer[i+ 1 ]; if (x> 0 )sma= Close [i+ 1 ]+x; else sma= Close [i+ 1 ]-y; MABuffer[i]=sma; i--; } //---- return ( 0 ); } //+------------------------------------------------------------------+ 다음은 수정 사항이 포함된 SVA_03 변형입니다. //+------------------------------------------------------------------+ //| SVA_03.mq4 | //| Copyright © 2006, MetaQuotes Software Corp. | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "Copyright © 2004, MetaQuotes Software Corp." #property link "http://www.metaquotes.net/" #property strict #property indicator_chart_window #property indicator_buffers 1 #property indicator_color1 Yellow //---- input parameters extern int RSIPeriod= 14 ; extern int Levl= 50 ; extern int TF= 0 ; //---- buffers double MABuffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { string short_name; IndicatorBuffers ( 1 ); SetIndexBuffer ( 0 ,MABuffer); //---- indicator line SetIndexStyle ( 0 , DRAW_LINE ); //---- //---- name for DataWindow and indicator subwindow label // short_name="RSI("+IntegerToString(RSIPeriod)+")"; short_name= "RSI(" +RSIPeriod+ ")" ; IndicatorShortName (short_name); SetIndexLabel ( 0 ,short_name); return ( 0 ); } //+------------------------------------------------------------------+ //| Relative Strength Index | //+------------------------------------------------------------------+ int start() { int i,counted_bars= IndicatorCounted (); double rel,negative,positive,sma,x,y,Pos,Neg; //---- if ( Bars <=RSIPeriod) return ( 0 ); if (TF!= 0 ) { string name= WindowExpertName (); for (i= 0 ; i< Bars -counted_bars+ 1 ; i++) { int barIndex= iBarShift ( NULL ,TF, Time [i], false ); MABuffer[i]= iCustom ( Symbol (),TF,name,RSIPeriod,Levl, 0 , 0 ,barIndex); } return ( 0 ); } i= Bars -RSIPeriod- 1 ; if (counted_bars>=RSIPeriod) i= Bars -counted_bars- 1 ; while (i>= 0 ) { double sumn= 0.0 ,sump= 0.0 ; if (i== Bars -RSIPeriod- 1 ) { int k= Bars - 2 ; //---- initial accumulation while (k>=i) { rel= Close [k]- Close [k+ 1 ]; if (rel> 0 ) sump+=rel; else sumn-=rel; k--; } positive=sump/RSIPeriod; negative=sumn/RSIPeriod; } else { //---- smoothed moving average rel= Close [i]- Close [i+ 1 ]; if (rel> 0 ) sump=rel; else sumn=-rel; positive=(Pos*(RSIPeriod- 1 )+sump)/RSIPeriod; negative=(Neg*(RSIPeriod- 1 )+sumn)/RSIPeriod; } x=Pos; y=Neg; Pos=positive; Neg=negative; if (x> 0 )sma= Close [i+ 1 ]+x; else sma= Close [i+ 1 ]-y; MABuffer[i]=sma; i--; } //---- return ( 0 ); } //+------------------------------------------------------------------+ 거기 대체 x=positive;; y=negative; 에 x=Pos; y=Neg; 역사는 수렴하지만 0 막대에 문제가 있습니다. 불일치가 있습니다. 어떻게 막을 수 있습니까? 파일: SVA_03.mq4 3 kb SVA_04.mq4 4 kb Any questions from newcomers Nesting indicators RSI sound alerts programing Aleksey Vyazmikin 2016.11.15 12:52 #83 실수로 잘못된 파일을 업로드했습니다 - 위에서 변경했습니다 ... Aleksey Vyazmikin 2016.11.15 14:00 #84 -Aleks- : История сходится, но проблемы на нулевом баре - имеется расхождение, как их купировать? 물론 제로바에서 재계산을 해서 문제가 되는건 알겠는데 어떻게 풀어야할지 감이 안오네요? Kot 2016.11.15 18:24 #85 안녕하세요! 돕다! 보류 중인 주문 을 여는 코드가 필요합니다. 그리고 주문 오픈 20분 후, 미결제 시 SL은 50포인트로 변경됩니다. 고맙습니다! mql4-2016 2016.11.15 19:27 #86 안녕하세요 아주 간단한(아마도) 질문을 도와주세요. 표준 기능이 있습니다. int ArraySize ( const void & array[]); "const void &"는 무엇을 의미하고 어떻게 사용합니까? 유사한 함수를 작성하려는 간단한 시도에도 컴파일 오류가 발생합니다. int test( const void & array[]) { return ArraySize (array);} 컴파일 오류: 'const' - 'void' 유형의 잘못된 사용 코드를 작성할 때 "const void &" 를 사용하는 올바른 방법은 무엇입니까 ? 그리고 그것은 전혀 가능합니까? Artyom Trishkin 2016.11.15 20:01 #87 mql4-2016 : 안녕하세요 아주 간단한(아마도) 질문을 도와주세요. 표준 기능이 있습니다. int ArraySize ( const void & array[]); "const void &"는 무엇을 의미하고 어떻게 사용합니까? 유사한 함수를 작성하려는 간단한 시도에도 컴파일 오류가 발생합니다. int test( const void & array[]) { return ArraySize (array);} 컴파일 오류: 'const' - 'void' 유형의 잘못된 사용 코드를 작성할 때 "const void &" 를 사용하는 올바른 방법은 무엇입니까 ? 그리고 그것은 전혀 가능합니까? void를 배열에 저장할 데이터 유형으로 바꾸십시오. 표준 기능은 템플릿으로 구성됩니다. 사실, 이 시스템 기능은 오버로드되어 있으며 이러한 오버로드의 전체 구현은 MQL4 프로그램 개발자에게 숨겨져 있습니다. int 배열 크기 ( 무효 & 정렬[] // 체크된 배열 ); 즉, 실제로 MQL4 언어의 컴파일러는 이 함수에 대한 각 호출에 필요한 구현을 대체합니다. 예를 들어 정수 유형의 배열은 다음과 같습니다. int 배열 크기 ( 정수 & 정렬[] // int 유형의 요소가 있는 배열 ); 그리고 과거 데이터 형식의 따옴표로 작업하기 위한 MqlRates 유형 배열의 경우 ArraySize() 함수는 다음과 같이 나타낼 수 있습니다. int 배열 크기 ( Mql요금 및 정렬[] // MqlRates 유형 값으로 채워진 배열 ); 포럼을 어지럽히 지 않도록 MT4 iMAOnArray 및 iBandsOnArray 어레이 초기화 Artyom Trishkin 2016.11.15 20:02 #88 Kot : 안녕하세요! 돕다! 보류 중인 주문 을 여는 코드가 필요합니다. 그리고 주문 오픈 20분 후, 미결제 시 SL은 50포인트로 변경됩니다. 고맙습니다! 어떻게 도와 드릴까요? 당신을 위해 작성? 프리랜서 입니다. mql4-2016 2016.11.15 20:14 #89 Artyom Trishkin : void를 배열에 저장할 데이터 유형으로 바꾸십시오. 표준 기능은 템플릿으로 구성됩니다. 사실 이 시스템 기능은 과부하가 걸리며 그러한 과부하의 전체 구현은 MQL4 프로그램 개발자에게 숨겨져 있습니다. MQL4/MQL5에서 "const void &" 구문이 실제로 참고서에 대한 상징적 표기법이며 실제로 함수에서 이런 식으로 작성하는 것이 불가능하다는 것을 올바르게 이해했습니까? 미리 감사드립니다 Artyom Trishkin 2016.11.15 20:34 #90 mql4-2016 : MQL4/MQL5에서 "const void &" 구문이 실제로 참고서에 대한 상징적 표기법이며 실제로 함수에서 이런 식으로 작성하는 것이 불가능하다는 것을 올바르게 이해했습니까? 미리 감사드립니다 금지되어 있습니다. 12345678910111213141516...1953 새 코멘트 트레이딩 기회를 놓치고 있어요: 무료 트레이딩 앱 복사용 8,000 이상의 시그널 금융 시장 개척을 위한 경제 뉴스 등록 로그인 공백없는 라틴 문자 비밀번호가 이 이메일로 전송될 것입니다 오류 발생됨 Google으로 로그인 웹사이트 정책 및 이용약관에 동의합니다. 계정이 없으시면, 가입하십시오 MQL5.com 웹사이트에 로그인을 하기 위해 쿠키를 허용하십시오. 브라우저에서 필요한 설정을 활성화하시지 않으면, 로그인할 수 없습니다. 사용자명/비밀번호를 잊으셨습니까? Google으로 로그인
이해하려고 합니다. 저것들. 당신이 생각하는 올바른 옵션은 SVA_03, 맞습니까?
예, 아마도. 하지만 _02는 확실히 틀렸습니다.
흠.. 내 자신에게서 한 가지 실수를 발견했다. 이제 거의 불일치가 없어. 여기가 원본입니다.
//| SVA_04.mq4 |
//| Copyright © 2006, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net/"
#property strict
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Yellow
//---- input parameters
extern int RSIPeriod= 14 ;
extern int Levl= 50 ;
extern int TF= 0 ;
//---- buffers
double MABuffer[];
double PosBuffer[];
double NegBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
string short_name;
IndicatorBuffers ( 1 );
SetIndexBuffer ( 0 ,MABuffer);
SetIndexBuffer ( 1 ,PosBuffer);
SetIndexBuffer ( 2 ,NegBuffer);
//---- indicator line
SetIndexStyle ( 0 , DRAW_LINE );
//----
//---- name for DataWindow and indicator subwindow label
// short_name="RSI("+IntegerToString(RSIPeriod)+")";
short_name= "RSI(" +RSIPeriod+ ")" ;
IndicatorShortName (short_name);
SetIndexLabel ( 0 ,short_name);
SetIndexLabel ( 1 , "U" );
SetIndexLabel ( 2 , "D" );
return ( 0 );
}
//+------------------------------------------------------------------+
//| Relative Strength Index |
//+------------------------------------------------------------------+
int start()
{
int i,counted_bars= IndicatorCounted ();
double rel,negative,positive,sma,x,y,Pos,Neg;
//----
if ( Bars <=RSIPeriod) return ( 0 );
if (TF!= 0 )
{
string name= WindowExpertName ();
for (i= 0 ; i< Bars -counted_bars+ 1 ; i++)
{
int barIndex= iBarShift ( NULL ,TF, Time [i], false );
MABuffer[i]= iCustom ( Symbol (),TF,name,RSIPeriod,Levl, 0 , 0 ,barIndex);
}
return ( 0 );
}
i= Bars -RSIPeriod- 1 ;
if (counted_bars>=RSIPeriod) i= Bars -counted_bars- 1 ;
while (i>= 0 )
{
double sumn= 0.0 ,sump= 0.0 ;
if (i== Bars -RSIPeriod- 1 )
{
int k= Bars - 2 ;
//---- initial accumulation
while (k>=i)
{
rel= Close [k]- Close [k+ 1 ];
if (rel> 0 ) sump+=rel;
else sumn-=rel;
k--;
}
positive=sump/RSIPeriod;
negative=sumn/RSIPeriod;
}
else
{
//---- smoothed moving average
rel= Close [i]- Close [i+ 1 ];
if (rel> 0 ) sump=rel;
else sumn=-rel;
positive=(PosBuffer[i+ 1 ]*(RSIPeriod- 1 )+sump)/RSIPeriod;
negative=(NegBuffer[i+ 1 ]*(RSIPeriod- 1 )+sumn)/RSIPeriod;
}
PosBuffer[i]=positive;
NegBuffer[i]=negative;
i--;
}
i= Bars -RSIPeriod- 1 ;
if (counted_bars>=RSIPeriod) i= Bars -counted_bars- 1 ;
while (i>= 0 )
{
x=PosBuffer[i+ 1 ];
y=NegBuffer[i+ 1 ];
if (x> 0 )sma= Close [i+ 1 ]+x;
else sma= Close [i+ 1 ]-y;
MABuffer[i]=sma;
i--;
}
//----
return ( 0 );
}
//+------------------------------------------------------------------+
다음은 수정 사항이 포함된 SVA_03 변형입니다.
//| SVA_03.mq4 |
//| Copyright © 2006, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net/"
#property strict
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Yellow
//---- input parameters
extern int RSIPeriod= 14 ;
extern int Levl= 50 ;
extern int TF= 0 ;
//---- buffers
double MABuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
string short_name;
IndicatorBuffers ( 1 );
SetIndexBuffer ( 0 ,MABuffer);
//---- indicator line
SetIndexStyle ( 0 , DRAW_LINE );
//----
//---- name for DataWindow and indicator subwindow label
// short_name="RSI("+IntegerToString(RSIPeriod)+")";
short_name= "RSI(" +RSIPeriod+ ")" ;
IndicatorShortName (short_name);
SetIndexLabel ( 0 ,short_name);
return ( 0 );
}
//+------------------------------------------------------------------+
//| Relative Strength Index |
//+------------------------------------------------------------------+
int start()
{
int i,counted_bars= IndicatorCounted ();
double rel,negative,positive,sma,x,y,Pos,Neg;
//----
if ( Bars <=RSIPeriod) return ( 0 );
if (TF!= 0 )
{
string name= WindowExpertName ();
for (i= 0 ; i< Bars -counted_bars+ 1 ; i++)
{
int barIndex= iBarShift ( NULL ,TF, Time [i], false );
MABuffer[i]= iCustom ( Symbol (),TF,name,RSIPeriod,Levl, 0 , 0 ,barIndex);
}
return ( 0 );
}
i= Bars -RSIPeriod- 1 ;
if (counted_bars>=RSIPeriod) i= Bars -counted_bars- 1 ;
while (i>= 0 )
{
double sumn= 0.0 ,sump= 0.0 ;
if (i== Bars -RSIPeriod- 1 )
{
int k= Bars - 2 ;
//---- initial accumulation
while (k>=i)
{
rel= Close [k]- Close [k+ 1 ];
if (rel> 0 ) sump+=rel;
else sumn-=rel;
k--;
}
positive=sump/RSIPeriod;
negative=sumn/RSIPeriod;
}
else
{
//---- smoothed moving average
rel= Close [i]- Close [i+ 1 ];
if (rel> 0 ) sump=rel;
else sumn=-rel;
positive=(Pos*(RSIPeriod- 1 )+sump)/RSIPeriod;
negative=(Neg*(RSIPeriod- 1 )+sumn)/RSIPeriod;
}
x=Pos;
y=Neg;
Pos=positive;
Neg=negative;
if (x> 0 )sma= Close [i+ 1 ]+x;
else sma= Close [i+ 1 ]-y;
MABuffer[i]=sma;
i--;
}
//----
return ( 0 );
}
//+------------------------------------------------------------------+
거기 대체
y=negative;
에
y=Neg;
안녕하세요!
돕다! 보류 중인 주문 을 여는 코드가 필요합니다. 그리고 주문 오픈 20분 후, 미결제 시 SL은 50포인트로 변경됩니다. 고맙습니다!
안녕하세요
아주 간단한(아마도) 질문을 도와주세요. 표준 기능이 있습니다.
"const void &"는 무엇을 의미하고 어떻게 사용합니까? 유사한 함수를 작성하려는 간단한 시도에도 컴파일 오류가 발생합니다.
return ArraySize (array);
}
컴파일 오류: 'const' - 'void' 유형의 잘못된 사용
코드를 작성할 때 "const void &" 를 사용하는 올바른 방법은 무엇입니까 ? 그리고 그것은 전혀 가능합니까?
안녕하세요
아주 간단한(아마도) 질문을 도와주세요. 표준 기능이 있습니다.
"const void &"는 무엇을 의미하고 어떻게 사용합니까? 유사한 함수를 작성하려는 간단한 시도에도 컴파일 오류가 발생합니다.
return ArraySize (array);
}
컴파일 오류: 'const' - 'void' 유형의 잘못된 사용
코드를 작성할 때 "const void &" 를 사용하는 올바른 방법은 무엇입니까 ? 그리고 그것은 전혀 가능합니까?
void를 배열에 저장할 데이터 유형으로 바꾸십시오. 표준 기능은 템플릿으로 구성됩니다.
사실, 이 시스템 기능은 오버로드되어 있으며 이러한 오버로드의 전체 구현은 MQL4 프로그램 개발자에게 숨겨져 있습니다.
int 배열 크기 (
무효 & 정렬[] // 체크된 배열
);
즉, 실제로 MQL4 언어의 컴파일러는 이 함수에 대한 각 호출에 필요한 구현을 대체합니다. 예를 들어 정수 유형의 배열은 다음과 같습니다.
int 배열 크기 (
정수 & 정렬[] // int 유형의 요소가 있는 배열
);
그리고 과거 데이터 형식의 따옴표로 작업하기 위한 MqlRates 유형 배열의 경우 ArraySize() 함수는 다음과 같이 나타낼 수 있습니다.
int 배열 크기 (
Mql요금 및 정렬[] // MqlRates 유형 값으로 채워진 배열
);
안녕하세요!
돕다! 보류 중인 주문 을 여는 코드가 필요합니다. 그리고 주문 오픈 20분 후, 미결제 시 SL은 50포인트로 변경됩니다. 고맙습니다!
void를 배열에 저장할 데이터 유형으로 바꾸십시오. 표준 기능은 템플릿으로 구성됩니다.
사실 이 시스템 기능은 과부하가 걸리며 그러한 과부하의 전체 구현은 MQL4 프로그램 개발자에게 숨겨져 있습니다.
MQL4/MQL5에서 "const void &" 구문이 실제로 참고서에 대한 상징적 표기법이며 실제로 함수에서 이런 식으로 작성하는 것이 불가능하다는 것을 올바르게 이해했습니까?
미리 감사드립니다
MQL4/MQL5에서 "const void &" 구문이 실제로 참고서에 대한 상징적 표기법이며 실제로 함수에서 이런 식으로 작성하는 것이 불가능하다는 것을 올바르게 이해했습니까?
미리 감사드립니다