오류, 버그, 질문 - 페이지 1093 1...108610871088108910901091109210931094109510961097109810991100...3184 새 코멘트 Anatoli Kazharski 2014.01.14 18:52 #10921 zfs : 코드의 색상이 설정되어 있음에도 불구하고 비어 있습니다. 그 모든 것에 대해 긍정적 인 결과가 있었지만 아무리 우스꽝스럽게 들리더라도 사라졌습니다). 그러면 문제를 재현하는 짧은 코드가 이해에 도움이 될 것입니다. Vasiliy Smirnov 2014.01.15 01:22 #10922 tol64 : 그러면 문제를 재현하는 짧은 코드가 이해에 도움이 될 것입니다. #property indicator_separate_window #property indicator_buffers 6 // Количество буферов для расчёта индикатора #property indicator_plots 2 // Количество графических серий #property indicator_label1 "Open;High;Low;Close" //перечисление методов отображения индикатора enum ViewInd { Line, // линии Bar, // бары Candles // свечи }; input ViewInd _ViewInd= Line; //вид индикатора double op[],cl[],hi[],lo[],s[]; double buffer_color_line[]; //Буфер для индекса цвета int OnInit () { for ( int i= 0 ;i<= 5 ;i++) PlotIndexSetDouble (i, PLOT_EMPTY_VALUE , 0 ); ArrayInitialize (op, 0 ); ArrayInitialize (cl, 0 ); ArrayInitialize (hi, 0 ); ArrayInitialize (lo, 0 ); ArrayInitialize (s, 0 ); if (_ViewInd==Line){ SetIndexBuffer ( 5 ,s, INDICATOR_DATA ); //Привязка массива к буферу PlotIndexSetInteger ( 5 , PLOT_DRAW_TYPE , DRAW_LINE ); PlotIndexSetInteger ( 5 , PLOT_LINE_STYLE , STYLE_SOLID ); PlotIndexSetInteger ( 5 , PLOT_LINE_COLOR , clrRed ); ArraySetAsSeries (s, true ); } else { SetIndexBuffer ( 0 ,op, INDICATOR_DATA ); SetIndexBuffer ( 1 ,hi, INDICATOR_DATA ); SetIndexBuffer ( 2 ,lo, INDICATOR_DATA ); SetIndexBuffer ( 3 ,cl, INDICATOR_DATA ); SetIndexBuffer ( 4 ,buffer_color_line, INDICATOR_COLOR_INDEX ); //Сопоставляем массив-буфер индексов цветов с буфером индикатора ArraySetAsSeries (op, true ); ArraySetAsSeries (hi, true ); ArraySetAsSeries (lo, true ); ArraySetAsSeries (cl, true ); ArraySetAsSeries (buffer_color_line, true ); //Задаем количество индексов цветов для графического построения PlotIndexSetInteger ( 0 , PLOT_COLOR_INDEXES , 2 ); if (_ViewInd==Candles) PlotIndexSetInteger ( 1 , PLOT_DRAW_TYPE , DRAW_COLOR_CANDLES ); else PlotIndexSetInteger ( 0 , PLOT_DRAW_TYPE , DRAW_COLOR_BARS ); //Задаем цвет для каждого индекса PlotIndexSetInteger ( 0 , PLOT_LINE_COLOR , 0 , clrBlue ); //Нулевой индекс -> Синий PlotIndexSetInteger ( 0 , PLOT_LINE_COLOR , 1 , clrOrange ); //Первый индекс -> Оранжевый } //--- 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; //MQL 4 RULEZZZ int counted_bars=prev_calculated; //---- last counted bar will be recounted if (counted_bars> 0 ) counted_bars--; limit=rates_total-counted_bars; for ( int i= 0 ;i<limit;i++){ if (_ViewInd==Line)s[i]= MathRand (); else { op[i]= MathRand (); cl[i]= MathRand (); if (op[i]>cl[i])buffer_color_line[i]= 1 ; else buffer_color_line[i]= 0 ; hi[i]= 32767 ; lo[i]= 0 ; } } return (rates_total); } //+------------------------------------------------------------------+ 다소 이렇습니다. Andrew Petras 2014.01.15 11:18 #10923 zfs : 다소 이렇습니다. 짧은 이름 뒤에 값이 표시되는 방식입니다. for ( int i= 0 ;i<= 5 ;i++) { PlotIndexSetDouble (i, PLOT_EMPTY_VALUE , 0 );}; 여기 에서 버퍼의 순서에 대해 설명합니다. https://www.mql5.com/ru/forum/12882#comment_539990 В каком порядке делать SetIndexBuffer() и зависит ли он он порядка директив #property indicator_x ? www.mql5.com может ли кто-то на пальцах обьяснить правила привязки индикаторного буфера к опр. Vasiliy Smirnov 2014.01.15 11:58 #10924 그리고 그것이 나에게 어떻게 도움이되는지, 나는 아무것도 이해하지 못했습니다). 뭔가 바뀔 수 있고 어떻게든 되겠지만 여전히 비뚤어진 부분이 있지만 좀 더 정확히 알고 싶습니다. Anatoli Kazharski 2014.01.15 12:02 #10925 zfs : 다소 이렇습니다. 완전한 혼돈과 혼돈. ) 작업 버전 유지(오류 수정 및 정리): //+------------------------------------------------------------------+ //| #Test.mq5 | //| Copyright 2010, MetaQuotes Software Corp. | //| http://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2010, MetaQuotes Software Corp." #property link "http://www.mql5.com" #property version "1.00" #property indicator_separate_window //--- #property indicator_buffers 5 // Количество буферов для расчёта индикатора #property indicator_plots 1 // Количество графических серий //--- #property indicator_color1 clrDodgerBlue , C'0,50,100' //--- Перечисление методов отображения индикатора enum ViewInd { Line, // линии Bar, // бары Candles // свечи }; //--- Внешние параметры input ViewInd _ViewInd =Line; // Вид индикатора //--- double op[],cl[],hi[],lo[]; double buffer_color_line[]; // Буфер для индекса цвета //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit () { //--- if (_ViewInd==Line) { //--- Привязка массива к буферу SetIndexBuffer ( 0 ,cl, INDICATOR_DATA ); //--- PlotIndexSetInteger ( 0 , PLOT_DRAW_TYPE , DRAW_LINE ); PlotIndexSetInteger ( 0 , PLOT_LINE_STYLE , STYLE_SOLID ); } else { SetIndexBuffer ( 0 ,op, INDICATOR_DATA ); SetIndexBuffer ( 1 ,hi, INDICATOR_DATA ); SetIndexBuffer ( 2 ,lo, INDICATOR_DATA ); SetIndexBuffer ( 3 ,cl, INDICATOR_DATA ); //--- Сопоставляем массив-буфер индексов цветов с буфером индикатора SetIndexBuffer ( 4 ,buffer_color_line, INDICATOR_COLOR_INDEX ); //--- if (_ViewInd==Candles) PlotIndexSetInteger ( 0 , PLOT_DRAW_TYPE , DRAW_COLOR_CANDLES ); else PlotIndexSetInteger ( 0 , PLOT_DRAW_TYPE , DRAW_COLOR_BARS ); } //--- Установим метки для текущего таймфрейма // В режиме линия только цена закрытия if (_ViewInd==Line) PlotIndexSetString ( 0 , PLOT_LABEL , "Close" ); //--- В других режимах все цены баров/свеч // В качестве разделителя используется ";" else if (_ViewInd==Bar || _ViewInd==Candles) PlotIndexSetString ( 0 , PLOT_LABEL , "Open;" + "High;" + "Low;" + "Close" ); //--- PlotIndexSetDouble ( 0 , PLOT_EMPTY_VALUE , 0 ); //--- ArrayInitialize (op, 0 ); ArrayInitialize (cl, 0 ); ArrayInitialize (hi, 0 ); ArrayInitialize (lo, 0 ); //--- 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= 0 ; //MQL 4 RULEZZZ //--- if (prev_calculated== 0 ) limit= 0 ; else limit=prev_calculated- 1 ; //--- for ( int i=limit; i<rates_total; i++) { if (_ViewInd==Line) cl[i]= MathRand (); else { op[i]= MathRand (); cl[i]= MathRand (); hi[i]= 32767 ; lo[i]= 1 ; //--- if (op[i]>cl[i]) buffer_color_line[i]= 1 ; else buffer_color_line[i]= 0 ; } } //--- return (rates_total); } //+------------------------------------------------------------------+ Andrew Petras 2014.01.15 12:12 #10926 이것이 작동하는 방식입니다 if (_ViewInd==Line){ } else { if (_ViewInd==Candles) else 만약 enum ViewInd { Line, // линии Bar, // бары Candles // свечи }; ? 모든 조건과 대괄호를 다시 확인하고 루프 없이 선형으로 버퍼의 속성을 설정합니다. 순서는 위 링크에서 가져옵니다. Anatoli Kazharski 2014.01.15 12:14 #10927 Silent : ... 모든 조건과 대괄호를 다시 확인하고 루프 없이 선형으로 버퍼의 속성을 설정합니다. 순서는 위 링크에서 가져옵니다. 주기가 필요하지 않습니다. 보다 정확하게는 모든 표시 옵션에서 하나의 버퍼에 대해서만 속성을 설정해야 합니다. Andrew Petras 2014.01.15 12:17 #10928 tol64 : 주기가 필요하지 않습니다. 일반적으로 그렇습니다. 그러나 버퍼가 많으면 더 짧을 것입니다 :-) 하지만 저는 그렇게 하지 않습니다. 선형 발보를 읽는 것이 더 쉽습니다. Anatoli Kazharski 2014.01.15 12:19 #10929 Silent : 일반적으로 그렇습니다. 그러나 버퍼가 많으면 더 짧을 것입니다 :-) 하지만 저는 그렇게 하지 않습니다. 선형 발보를 읽는 것이 더 쉽습니다. 사실, 버퍼가 너무 많아서(최대 512) 발보지 사이클이 없으면 읽기가 훨씬 더 어려울 수 있습니다. ) 이 버전에는 버퍼가 하나만 있습니다. Vasiliy Smirnov 2014.01.15 12:33 #10930 tol64 : 주기가 필요하지 않습니다. 감독자). 고맙습니다. 시계처럼. 코냑은 차가워집니다). 1...108610871088108910901091109210931094109510961097109810991100...3184 새 코멘트 트레이딩 기회를 놓치고 있어요: 무료 트레이딩 앱 복사용 8,000 이상의 시그널 금융 시장 개척을 위한 경제 뉴스 등록 로그인 공백없는 라틴 문자 비밀번호가 이 이메일로 전송될 것입니다 오류 발생됨 Google으로 로그인 웹사이트 정책 및 이용약관에 동의합니다. 계정이 없으시면, 가입하십시오 MQL5.com 웹사이트에 로그인을 하기 위해 쿠키를 허용하십시오. 브라우저에서 필요한 설정을 활성화하시지 않으면, 로그인할 수 없습니다. 사용자명/비밀번호를 잊으셨습니까? Google으로 로그인
코드의 색상이 설정되어 있음에도 불구하고 비어 있습니다. 그 모든 것에 대해 긍정적 인 결과가 있었지만 아무리 우스꽝스럽게 들리더라도 사라졌습니다).
그러면 문제를 재현하는 짧은 코드가 이해에 도움이 될 것입니다.
다소 이렇습니다.
짧은 이름 뒤에 값이 표시되는 방식입니다.
여기 에서 버퍼의 순서에 대해 설명합니다. https://www.mql5.com/ru/forum/12882#comment_539990다소 이렇습니다.
완전한 혼돈과 혼돈. ) 작업 버전 유지(오류 수정 및 정리):
이것이 작동하는 방식입니다
만약
?
모든 조건과 대괄호를 다시 확인하고 루프 없이 선형으로 버퍼의 속성을 설정합니다. 순서는 위 링크에서 가져옵니다.
...
모든 조건과 대괄호를 다시 확인하고 루프 없이 선형으로 버퍼의 속성을 설정합니다. 순서는 위 링크에서 가져옵니다.
주기가 필요하지 않습니다.
일반적으로 그렇습니다. 그러나 버퍼가 많으면 더 짧을 것입니다 :-) 하지만 저는 그렇게 하지 않습니다. 선형 발보를 읽는 것이 더 쉽습니다.
주기가 필요하지 않습니다.