오류, 버그, 질문 - 페이지 917

 
Konstantin83 :

csv 형식으로 파일을 저장할 때 데이터가 열로 분할되지 않습니다. 표준 예제의 스크립트조차도 모든 데이터를 하나의 열에 표시합니다.

구분 기호 지정:

filehandle= FileOpen ( "fractals.csv" , FILE_WRITE | FILE_CSV , "," );
 
tol64 :

구분 기호 지정:

도움이되지 않았습니다. 엑셀에서 열 때 파일 형식을 알 수 없고 열로 나누지 않았다고 썼습니다. 그러나 구분 기호를 지정하지 않고 파일 확장명을 지정하지 않으면 형식을 알 수 없지만 텍스트가 열에서 비트는 ...
 
Konstantin83 :
도움이되지 않았습니다. 엑셀에서 열 때 파일 형식을 알 수 없고 열로 나누지 않았다고 썼습니다. 그러나 구분 기호를 지정하지 않고 파일 확장명을 지정하지 않으면 형식을 알 수 없지만 텍스트가 열에서 비트는 것으로 표시됩니다...

다음은 추가로 수행해야 할 작업입니다.

filehandle= FileOpen ( "fractals.csv" , FILE_WRITE | FILE_CSV | FILE_ANSI , "," );
 
신호의 그래프에 일종의 결함이 있습니다. 아니면 나만?
 

예를 들어 close[] 줄과 왼쪽 상단에 표시되는 주석과 같이 줄 버퍼가 있는 표시기를 만들 수 있습니까? 터미널이 멈추도록 가장 간단한 예를 만들려고했습니다.

 #property indicator_chart_window
#property indicator_buffers 1
#property indicator_plots   1
//--- plot Histogram
#property indicator_label1   "1"
#property indicator_type1   DRAW_LINE
#property indicator_color1  clrBlue
#property indicator_style1  STYLE_SOLID
#property indicator_width1   2
double MAbuf1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit ()
  {
//--- indicator buffers mapping
   ChartGetInteger ( 0 , CHART_VISIBLE_BARS );
   SetIndexBuffer ( 0 ,MAbuf1, INDICATOR_DATA );
   return ( 0 );
  }
//+------------------------------------------------------------------+
//| 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 start= 0 ;
//--- если расчет уже производился на предыдущем запуске OnCalculate
   if (prev_calculated> 0 ) start=prev_calculated- 1 ; // установим начало расчетов с предпослденего бара
//--- заполняем индикаторный буфер значениями
   for ( int i=start;i<rates_total;i++)
     {
       //----------------------Обнуляем буферы
      MAbuf1[i]= 0 ;
      MAbuf1[i]=close[i];
       Comment ( "Work" );


     }
//--- вернем значение prev_calculated для следующего вызова функции
   return (rates_total);
  }
 
주기에서 주석을 빼내면 기분이 좋아질 것입니다.
 
Dima_S :
주기에서 주석을 빼내면 기분이 좋아질 것입니다.
고마워, 나는 그것이 그런 시스템을로드 할 수 있다고 생각하지 않았다
 
#resource 옵션은 언제 지표 파일에 적용됩니까? 아마도 누군가 알고 있습니까? 전체 프로젝트 를 하나의 .ex5 파일로 결합하고 싶습니다.
 
MoneyJinn :
#resource 옵션은 언제 지표 파일에 적용됩니까? 아마도 누군가 알고 있습니까? 전체 프로젝트를 하나의 .ex5 파일로 결합하고 싶습니다.
그런 기회를 약속한 것 같지만 시기는 말하지 않았다.
 

두 번째 버퍼(label2)가 0인 이유를 설명해 주십시오.

 #property indicator_chart_window
#property indicator_buffers 2
#property indicator_plots   2
//--- plot Label1
#property indicator_label1   "Label1"
#property indicator_type1   DRAW_LINE
#property indicator_color1  clrRed
#property indicator_style1  STYLE_SOLID
#property indicator_width1   1
//--- plot Label2
#property indicator_label2   "Label2"
#property indicator_type2   DRAW_LINE
#property indicator_color2  clrWhite
#property indicator_style2  STYLE_SOLID
#property indicator_width2   1
//--- indicator buffers
double ExtLineBuffer[];
double ExtLineBuffer2[];
int     InpMAPeriod= 13 ;         // Period
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit ()
  {
//--- indicator buffers mapping
   SetIndexBuffer ( 0 ,ExtLineBuffer, INDICATOR_DATA );
   SetIndexBuffer ( 1 ,ExtLineBuffer2, INDICATOR_DATA );
   PlotIndexSetDouble ( 0 , PLOT_EMPTY_VALUE , 0.0 );
   
//---
   return ( 0 );
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate ( const int rates_total,
                 const int prev_calculated,
                 const int begin,
                 const double &price[])
  {
//--- check for bars count
   if (rates_total<InpMAPeriod- 1 +begin)
       return ( 0 ); // not enough bars for calculation
//--- first calculation or number of bars was changed
   if (prev_calculated== 0 )
       ArrayInitialize (ExtLineBuffer, 0 );
//--- sets first bar from what index will be draw
      InpMAPeriod= 20 ;
   int i,limit;
//--- first calculation or number of bars was changed
   if (prev_calculated== 0 ) // first calculation
     {
      limit=InpMAPeriod+begin;
       //--- set empty value for first limit bars
       for (i= 0 ;i<limit- 1 ;i++) ExtLineBuffer[i]= 0.0 ;
       //--- calculate first visible value
       double firstValue= 0 ;
       for (i=begin;i<limit;i++)
         firstValue+=price[i];
      firstValue/=InpMAPeriod;
      ExtLineBuffer[limit- 1 ]=firstValue;
       //ExtLineBuffer[i]=1;
     }
   else limit=prev_calculated- 1 ;
//--- main loop
   for (i=limit;i<rates_total && ! IsStopped ();i++)
   ExtLineBuffer[i]=ExtLineBuffer[i- 1 ]+(price[i]-price[i-InpMAPeriod])/InpMAPeriod;
   ExtLineBuffer2[i]=ExtLineBuffer[i];
//--- return value of prev_calculated for next call
   Comment (ExtLineBuffer[rates_total- 1 ]);
   return (rates_total);
  }
//+------------------------------------------------------------------+

1) 어떤 이유에서인지, 별도의 닫기, 열기 등이 있는 OnCalculate 기능 으로 다중 버퍼에 문제 없음

2) 기꺼이 사용하고 싶지만 이동 평균 계산 알고리즘을 넣을 수 없습니다. 위 코드에서

ExtLineBuffer2[i]는 상수를 포함하여 다른 값을 할당하려고 했습니다 - 항상 0