어레이가 범위를 벗어 났을 수 있으며 표시기가 제거되고 있습니다.
int limit=rates_total-prev_calculated;
for ( int i= 0 ; i<limit; i++)
iStochastic ( NULL , 0 ,kperiod,dperiod,slow, 0 , 0 , 0 , i+ 1 )< iStochastic ( NULL , 0 ,kperiod,dperiod,slow, 0 , 0 , 1 , i+ 1 ))
전역 초기화 실패에 대한 로그에 메시지가 표시될 수 있습니다.
로그 확인
코드를 컴파일하고 테스트한 오류가 있습니다.
2014.05.22 22:39:43.936 커스텀 인디케이터 테스트 인디케이터 3 XAUUSD,M1: 제거
2014.05.22 22:39:43.905 테스트 지표 3 XAUUSD,M1: 글로벌 초기화 실패
2014.05.22 22:39:43.905 테스트 지표 3 XAUUSD,M5: 단위 이유 3 //----------------------- 차트 변경
2014.05.22 22:39:17.323 'Test Indicator 3.mq4' 의 범위를 벗어난 배열 (117,32)
2014.05.22 22:39:15.591 테스트 지표 3 XAUUSD,M5: 초기화
2014.05.22 22:39:09.570 사용자 지정 표시기 테스트 표시기 3 XAUUSD,M5: 성공적으로 로드됨
표시기가 먼저 시작될 때 행을 추가해야 합니다. prev_calculated == 0,
그런 것 :
int limit = - 100 ; if ( prev_calculated == 0 ) limit = 3000 ;// will calculate 3000 Bars else limit = rates_total-prev_calculated;
내 컴퓨터에도 오류가 없습니다 ;-)
안녕하세요 foorr님
당신의 솔루션은 정말 좋습니다.
사실을 말하자면, 나는 어젯밤에 그것을 고칠 사람을 고용했습니다. 예, 그는 해냈지만 코드가 비효율적입니다. 아래를 참조하십시오. 그가 for(i)에 대해 하나를 더 추가했기 때문입니다.
prev_calculated ==0이 의미하는 바를 설명해 주시면 감사하겠습니다. 나는 그것을 이해하지 못한다.
//+------------------------------------------------------------------+ //| hf1.mq4 | //| Copyright 2013, MetaQuotes Software Corp. | //| httakeprofit://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2013, MetaQuotes Software Corp." #property link "httakeprofit://www.mql5.com" #property version "1.00" #property strict //--- indicator settings //#property indicator_chart_window #property indicator_separate_window #property indicator_buffers 5 #property indicator_width1 2 #property indicator_width2 2 #property indicator_width3 1 #property indicator_width4 1 #property indicator_width5 1 #property indicator_color1 Yellow #property indicator_color2 Red #property indicator_color3 Red #property indicator_color4 Orange #property indicator_color5 Orange //--- input parameter input int kperiod= 30 ; input int dperiod= 9 ; input int slow= 9 ; input int sample_roc_quartile= 100 ; //--- buffers double buy[]; double sell[]; double stoploss[]; double takeprofit1[]; double takeprofit2[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit ( void ) //*/*/*/*/*/ { //--- indicator buffers mapping //--- 1 additional buffer used for counting. //IndicatorBuffers(6); IndicatorDigits( Digits ); //--- indicator line SetIndexStyle( 0 , DRAW_ARROW ); SetIndexBuffer ( 0 ,buy); SetIndexArrow( 0 , 241 ); SetIndexStyle( 1 , DRAW_ARROW ); SetIndexBuffer ( 1 ,sell); SetIndexArrow( 1 , 242 ); SetIndexStyle( 2 , DRAW_ARROW ); SetIndexBuffer ( 2 ,stoploss); SetIndexStyle( 3 , DRAW_ARROW ); SetIndexBuffer ( 3 ,takeprofit2); SetIndexStyle( 4 , DRAW_ARROW ); SetIndexBuffer ( 4 ,takeprofit1); //--- name for DataWindow and indicator subwindow label //--- return (INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int OnCalculate ( const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { int limit=rates_total-prev_calculated; if (limit<= 0 )limit = 2 ; double roc_s[]; ArrayResize (roc_s,sample_roc_quartile+ 1 ); //--- //------------------------------------------ for ( int i= 1 ; i<limit; i++) { //FIRST PSART if ( iStochastic ( NULL , 0 ,kperiod,dperiod,slow, 0 , 0 , 0 ,i)> iStochastic ( NULL , 0 ,kperiod,dperiod,slow, 0 , 0 , 1 ,i) && iStochastic ( NULL , 0 ,kperiod,dperiod,slow, 0 , 0 , 0 ,i+ 1 )< iStochastic ( NULL , 0 ,kperiod,dperiod,slow, 0 , 0 , 1 ,i+ 1 )) { buy[i]=Close[i]; stoploss[i]=Low[i]- 0.005 ; takeprofit1[i]=Close[i]+ 0.005 ; takeprofit2[i]=Close[i]+ 0.01 ; } if ( iStochastic ( NULL , 0 ,kperiod,dperiod,slow, 0 , 0 , 0 ,i)< iStochastic ( NULL , 0 ,kperiod,dperiod,slow, 0 , 0 , 1 ,i) && iStochastic ( NULL , 0 ,kperiod,dperiod,slow, 0 , 0 , 0 ,i+ 1 )> iStochastic ( NULL , 0 ,kperiod,dperiod,slow, 0 , 0 , 1 ,i+ 1 )) { sell[i]=Close[i]; stoploss[i]=High[i]; takeprofit1[i]=Close[i]- 0.0050 ; takeprofit2[i]=Close[i]- 0.01 ; } } //SECOND PART //--------------------------------------- HERE IS THE WHAT HE DID int mid = (sample_roc_quartile + 1 )/ 2 ; for ( int i= 1 ; i<limit&&(i+ 1 )<rates_total; i++) { //--------------------------------------------- for ( int j= 0 ;j<=sample_roc_quartile&&(i+j+ 1 )<rates_total;j++) { roc_s[j]=Close[i+j]-Close[i+j+ 1 ]; ArraySort (roc_s); } if ( (Close[i]-Close[i+ 1 ])<roc_s[mid] ) { buy[i]= 0 ; stoploss[i]= 0 ; takeprofit1[i]= 0 ; takeprofit2[i]= 0 ; } } //--- return value of prev_calculated for next call return (rates_total); } //+------------------------------------------------------------------+
안녕하세요 여러분...
IBFX MACD 기존 표시기 및 기타 템플릿을 MT4에 설치하는 데 문제가 있습니다.
이전 버전에서는 "expert" 폴더에 있는 "indicator" 폴더에 내 파일을 복사하여 붙여넣기만 하면 됩니다.
현재 폴더에는 별도의 "expert" 및 "indicator" 폴더로 구성된 "MQL4" 폴더만 있습니다.
두 폴더에 붙여넣고 플랫폼을 다시 시작하려고 시도했지만 작동하지 않습니다.
발생합니다.
이 문제에 대해 조언해 줄 수 있는 사람이 있습니까? 또는 2개의 EMA 라인이 있는 기존 MACD 표시기 를 얻을 수 있는 다른 방법이 있습니까?
감사해요
더글라스douglas_heng : IBFX MACD 기존 표시기 및 기타 템플릿을 MT4에 설치하는 데 문제가 있습니다. | 게시물을 여러 개 (6) 개 만들지 마세요 . 다른 사람의 게시물을 도용하지 마십시오. |
안녕하세요 foorr님
당신의 솔루션은 정말 좋습니다.
사실을 말하자면, 나는 어젯밤에 그것을 고칠 사람을 고용했습니다. 예, 그는 해냈지만 코드가 비효율적입니다. 아래를 참조하십시오. 그가 for(i)에 대해 하나를 더 추가했기 때문입니다.
prev_calculated ==0이 의미하는 바를 설명해 주시면 감사하겠습니다. 나는 그것을 이해하지 못한다.
음 scfx, 표시기의 두 번째 부분을 이해하지 못하므로 말할 수 없습니다.
지표가 처음 시작될 때(차트에 표시) previous_calculation은 구성상 0과 같으므로 지표가 계산을 시작하는 시작점을 수정할 수 있습니다.
if( prev_calculated == 0) 한계 = 100;
또는
if( prev_calculated < 50) 제한 = 500:
또는 말하다
if( prev_calculated < 500) limit = 3000: (모두 동일, 차트의 시작 부분은 사용되지 않음)
int limit = - 100 ; if ( prev_calculated == 0 ) limit = 3000 ;// will calculate 3000 Bars else limit = rates_total-prev_calculated; at the first lauch of the indicator limit = 3000; for ( int i= 1 ; i<3000; i++) // draw 3000 bars at the second lauch limit = 0; // ( because rates_total-prev_calculated = 0) ; for ( int i= 1 ; i<0; i++) // draw the last bars only, faster
아주 좋은 생각이 인디 ......
여보세요,
나는 지표(The FIRST PART)로 시작합니다. 시간 프레임을 변경할 때 잘 작동합니다.
그런 다음 두 번째 부분을 추가합니다. Close[i]-Close[i+1]이 마지막 100bar 차이 값의 중앙값보다 작으면 모든 버퍼에 값 0을 할당합니다.
이제 결합된 표시기가 1개의 차트에서 제대로 작동하지만 시간 프레임을 변경하면 해당 표시기가 사라집니다. 차트에 다시 첨부해야 합니다.
Array로 인해 문제가 발생한 것 같은데 해결 방법을 모르겠습니다.
누구든지 오류로 나를 도울 수 있습니까?
정말 감사합니다.
SCFX