MQL4 및 MQL5에 대한 초보자 질문, 알고리즘 및 코드에 대한 도움말 및 토론 - 페이지 8 123456789101112131415...1953 새 코멘트 Vitaly Muzichenko 2016.11.15 00:21 #71 Andrei Gerasimenko : mql4를 사용하여 그러한 알고리즘을 구현하고자 하는 열망이 있습니다. 다른 브로커의 2개의 MT4 터미널이 있습니다. 하나는 (시장에서와 같이) 어떤 식으로든 다른 터미널로 끌 수 없는 "독점적인" 표시기를 가지고 있습니다. 여기 있습니다! 어떻게든 "독점적인" 표시기의 버퍼에서 판독값을 가져와 터미널의 표시기에 구현할 수 있습니까? 리소스는 어떻게 든 실패합니다. 옵션 번호 1 = Mikhalych로 계정 개설(맞나요?) 옵션 번호 2 = 지표 데이터를 파일에 저장하고 저장할 지표 를 작성한 다음 다른 터미널의 다른 지표에서 이 파일을 읽고 이를 사용하여 라인을 생성합니다. Aleksey Vyazmikin 2016.11.15 03:13 #72 도와주세요 - 인디케이터를 가볍게 만들려고 합니다 - RSI 리메이크인데 인디케이터 값이 왜 다른지 모르겠네요? //+------------------------------------------------------------------+ //| SVA_02.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; } Pos=positive; Neg=negative; i--; } i= Bars -RSIPeriod- 1 ; if (counted_bars>=RSIPeriod) i= Bars -counted_bars- 1 ; while (i>= 0 ) { x=positive; y=negative; if (x> 0 )sma= Close [i+ 1 ]+x; else sma= Close [i+ 1 ]-y; MABuffer[i]=sma; i--; } //---- return ( 0 ); } //+------------------------------------------------------------------+ 그리고 //+------------------------------------------------------------------+ //| 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=positive; y=negative; Pos=positive; Neg=negative; if (x> 0 )sma= Close [i+ 1 ]+x; else sma= Close [i+ 1 ]-y; MABuffer[i]=sma; i--; } //---- return ( 0 ); } //+------------------------------------------------------------------+ 파일: SVA_02.mq4 4 kb SVA_03.mq4 4 kb Any questions from newcomers Nesting indicators RSI sound alerts programing Artyom Trishkin 2016.11.15 08:09 #73 -Aleks- : 도와주세요 - 인디케이터를 가볍게 만들려고 합니다 - RSI 리메이크인데 인디케이터 값이 왜 다른지 모르겠네요? ... 그리고 ... 당신이 무엇을 하려고 했는지, 무엇을 잘못했는지, 그리고 결국 무엇을 얻고자 했는지는 전혀 분명하지 않습니다. Dmitry Fedoseev 2016.11.15 08:32 #74 -Aleks- : 도와주세요 - 인디케이터를 가볍게 만들려고 합니다 - RSI 리메이크인데 인디케이터 값이 왜 다른지 모르겠네요? 03에서는 막대에 대해 양수와 음수를 계산하고 즉시 평균을 계산하는 데 사용했습니다. 02에서 양수와 음수에서 별도의주기의 평균 계산은 무엇입니까? 무언가가 있지만 계산된 막대에는 해당되지 않습니다. Aleksey Vyazmikin 2016.11.15 11:03 #75 Artyom Trishkin : 당신이 무엇을 하려고 했는지, 무엇을 잘못했는지, 그리고 결국 무엇을 얻고자 했는지는 전혀 분명하지 않습니다. 처음에 RSI 부분을 계산할 때 여분의 버퍼를 제거하려고 시도했는데 이론적으로 여분의 버퍼를 제거하는 것은 다음과 같습니다. 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--; } PosBuffer[i] 및 NegBuffer[i]는 실제로 양수 및 음수 값의 과거 값으로, 한 막대보다 더 깊게 사용되지 않지만 메모리를 소비하므로 다음과 같습니다. 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; } Pos=positive; Neg=negative; i--; } 그런 다음 동일한 주기에서 SVA_02를 추가로 계산하는 지표의 일부를 잘라냅니다(코드의 문제가 있는 부분이 제공됨). i= Bars -RSIPeriod- 1 ; if (counted_bars>=RSIPeriod) i= Bars -counted_bars- 1 ; while (i>= 0 ) { x=positive; y=negative; if (x> 0 )sma= Close [i+ 1 ]+x; else sma= Close [i+ 1 ]-y; MABuffer[i]=sma; i--; } 그런 다음주기가 동일하기 때문에 계산을 첫 번째주기에 넣을 수 있다고 생각했습니다. SVA_03 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=positive; y=negative; Pos=positive; Neg=negative; if (x> 0 )sma= Close [i+ 1 ]+x; else sma= Close [i+ 1 ]-y; MABuffer[i]=sma; i--; } //---- return ( 0 ); } 마지막 단계에서 MABuffer[i]의 결과가 SVA_02와 SVA_03에서 다르다는 것이 밝혀졌습니다. 논리적으로 오류가 무엇인지 이해할 수 없습니다. Any questions from newcomers RSI Formula used in Nesting indicators Aleksey Vyazmikin 2016.11.15 11:08 #76 Dmitry Fedoseev : 03에서는 막대에 대해 양수와 음수를 계산하고 즉시 평균을 계산하는 데 사용했습니다. 02에서 양수와 음수에서 별도의주기의 평균 계산은 무엇입니까? 무언가가 있지만 계산된 막대에는 해당되지 않습니다. 예, 하지만 실제 차이점은 무엇입니까? 주기는 동일합니다. 논리적 오류가 무엇인지 이해하도록 도와주세요. Dmitry Fedoseev 2016.11.15 11:18 #77 -Aleks- : 예, 하지만 실제 차이점은 무엇입니까? 주기는 동일합니다. 논리적 오류가 무엇인지 이해하도록 도와주세요. 어떻게 설명할 수 있습니까? 여기에서 이미 설명했습니다. 이 설명으로 옳지 않은 것은? Al은 그런 생활 방식입니다-바보를 운전하고 바보처럼 깎습니까? 그 후에 어떻게 설명할 수 있습니까? 머리에 망치? 자, 헬멧을 벗으세요. Aleksey Vyazmikin 2016.11.15 11:22 #78 Dmitry Fedoseev : 어떻게 설명할 수 있습니까? 여기에서 이미 설명했습니다. 이 설명으로 옳지 않은 것은? Al은 그런 생활 방식입니다-바보를 운전하고 바보처럼 깎습니까? 그 후에 어떻게 설명할 수 있습니까? 머리에 큰 망치? 자, 헬멧을 벗으세요. 예, " 무언가가 있지만 계산된 막대에는 해당되지 않습니다. "라는 문구가 이상하게 들립니다. 이전 양수 및 음수 사이클의 사이클에 값이 있기 때문입니다. Dmitry Fedoseev 2016.11.15 11:25 #79 -Aleks- : 예, " 무언가가 있지만 계산된 막대에는 해당되지 않습니다. "라는 문구가 이상하게 들립니다. 이전 양수 및 음수 사이클의 사이클에 값이 있기 때문입니다. 일부 마지막 막대의 마지막 주기에서 무언가가 남아 있고 각 막대에 적용합니다. 올바른 버전에서는 변수에 아무것도 남아 있지 않지만 각 막대에 대해 계산되고 평균을 계산하는 데 즉시 사용됩니다. Aleksey Vyazmikin 2016.11.15 11:51 #80 Dmitry Fedoseev : 일부 마지막 막대의 마지막 주기에서 무언가가 남아 있고 각 막대에 적용합니다. 올바른 버전에서는 변수에 아무것도 남아 있지 않지만 각 막대에 대해 계산되고 평균을 계산하는 데 즉시 사용됩니다. 이해하려고 합니다. 저것들. 당신이 생각하는 올바른 옵션은 SVA_03, 맞습니까? 123456789101112131415...1953 새 코멘트 트레이딩 기회를 놓치고 있어요: 무료 트레이딩 앱 복사용 8,000 이상의 시그널 금융 시장 개척을 위한 경제 뉴스 등록 로그인 공백없는 라틴 문자 비밀번호가 이 이메일로 전송될 것입니다 오류 발생됨 Google으로 로그인 웹사이트 정책 및 이용약관에 동의합니다. 계정이 없으시면, 가입하십시오 MQL5.com 웹사이트에 로그인을 하기 위해 쿠키를 허용하십시오. 브라우저에서 필요한 설정을 활성화하시지 않으면, 로그인할 수 없습니다. 사용자명/비밀번호를 잊으셨습니까? Google으로 로그인
mql4를 사용하여 그러한 알고리즘을 구현하고자 하는 열망이 있습니다.
다른 브로커의 2개의 MT4 터미널이 있습니다. 하나는 (시장에서와 같이) 어떤 식으로든 다른 터미널로 끌 수 없는 "독점적인" 표시기를 가지고 있습니다.
여기 있습니다! 어떻게든 "독점적인" 표시기의 버퍼에서 판독값을 가져와 터미널의 표시기에 구현할 수 있습니까?
리소스는 어떻게 든 실패합니다.
옵션 번호 1 = Mikhalych로 계정 개설(맞나요?)
옵션 번호 2 = 지표 데이터를 파일에 저장하고 저장할 지표 를 작성한 다음 다른 터미널의 다른 지표에서 이 파일을 읽고 이를 사용하여 라인을 생성합니다.
도와주세요 - 인디케이터를 가볍게 만들려고 합니다 - RSI 리메이크인데 인디케이터 값이 왜 다른지 모르겠네요?
//| SVA_02.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;
}
Pos=positive;
Neg=negative;
i--;
}
i= Bars -RSIPeriod- 1 ;
if (counted_bars>=RSIPeriod) i= Bars -counted_bars- 1 ;
while (i>= 0 )
{
x=positive;
y=negative;
if (x> 0 )sma= Close [i+ 1 ]+x;
else sma= Close [i+ 1 ]-y;
MABuffer[i]=sma;
i--;
}
//----
return ( 0 );
}
//+------------------------------------------------------------------+
그리고
//| 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=positive;
y=negative;
Pos=positive;
Neg=negative;
if (x> 0 )sma= Close [i+ 1 ]+x;
else sma= Close [i+ 1 ]-y;
MABuffer[i]=sma;
i--;
}
//----
return ( 0 );
}
//+------------------------------------------------------------------+
도와주세요 - 인디케이터를 가볍게 만들려고 합니다 - RSI 리메이크인데 인디케이터 값이 왜 다른지 모르겠네요?
...
그리고
...
도와주세요 - 인디케이터를 가볍게 만들려고 합니다 - RSI 리메이크인데 인디케이터 값이 왜 다른지 모르겠네요?
당신이 무엇을 하려고 했는지, 무엇을 잘못했는지, 그리고 결국 무엇을 얻고자 했는지는 전혀 분명하지 않습니다.
처음에 RSI 부분을 계산할 때 여분의 버퍼를 제거하려고 시도했는데 이론적으로 여분의 버퍼를 제거하는 것은 다음과 같습니다.
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--;
}
PosBuffer[i] 및 NegBuffer[i]는 실제로 양수 및 음수 값의 과거 값으로, 한 막대보다 더 깊게 사용되지 않지만 메모리를 소비하므로 다음과 같습니다.
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;
}
Pos=positive;
Neg=negative;
i--;
}
그런 다음 동일한 주기에서 SVA_02를 추가로 계산하는 지표의 일부를 잘라냅니다(코드의 문제가 있는 부분이 제공됨).
if (counted_bars>=RSIPeriod) i= Bars -counted_bars- 1 ;
while (i>= 0 )
{
x=positive;
y=negative;
if (x> 0 )sma= Close [i+ 1 ]+x;
else sma= Close [i+ 1 ]-y;
MABuffer[i]=sma;
i--;
}
그런 다음주기가 동일하기 때문에 계산을 첫 번째주기에 넣을 수 있다고 생각했습니다. SVA_03
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=positive;
y=negative;
Pos=positive;
Neg=negative;
if (x> 0 )sma= Close [i+ 1 ]+x;
else sma= Close [i+ 1 ]-y;
MABuffer[i]=sma;
i--;
}
//----
return ( 0 );
}
마지막 단계에서 MABuffer[i]의 결과가 SVA_02와 SVA_03에서 다르다는 것이 밝혀졌습니다. 논리적으로 오류가 무엇인지 이해할 수 없습니다.
03에서는 막대에 대해 양수와 음수를 계산하고 즉시 평균을 계산하는 데 사용했습니다. 02에서 양수와 음수에서 별도의주기의 평균 계산은 무엇입니까? 무언가가 있지만 계산된 막대에는 해당되지 않습니다.
예, 하지만 실제 차이점은 무엇입니까? 주기는 동일합니다. 논리적 오류가 무엇인지 이해하도록 도와주세요.
어떻게 설명할 수 있습니까? 여기에서 이미 설명했습니다. 이 설명으로 옳지 않은 것은? Al은 그런 생활 방식입니다-바보를 운전하고 바보처럼 깎습니까? 그 후에 어떻게 설명할 수 있습니까? 머리에 큰 망치? 자, 헬멧을 벗으세요.
예, " 무언가가 있지만 계산된 막대에는 해당되지 않습니다. "라는 문구가 이상하게 들립니다. 이전 양수 및 음수 사이클의 사이클에 값이 있기 때문입니다.
일부 마지막 막대의 마지막 주기에서 무언가가 남아 있고 각 막대에 적용합니다. 올바른 버전에서는 변수에 아무것도 남아 있지 않지만 각 막대에 대해 계산되고 평균을 계산하는 데 즉시 사용됩니다.
이해하려고 합니다. 저것들. 당신이 생각하는 올바른 옵션은 SVA_03, 맞습니까?