스크립트: Export Indicator's Values - 페이지 2

[삭제]  
작동하지 않습니다.
 
50주기 지수이동평균의 값을 내보낼 수 없는데 누가 도와줄 수 있나요?
 

다음 폴더에서 파일 검색

C:\사용자\XXX\앱데이터\로밍\메타퀘스트\터미널\ZXVVDASDADDEDADS23132\MQL5\파일

 
Automated-Trading:

인디케이터 값 내보내기:

저자: NFTrader

스크립트는 매우 훌륭하지만 데이터가 RTD 서버를 통해 엑셀로 직접 이동하여 엑셀의 RDTR 기능을 사용할 수 있으면 더 좋겠습니다. 그런 계획이 있으신가요?
 
Automated-Trading:

인디케이터 값 내보내기:

저자: NFTrader

 
Jose Luis Perez Navarro:
스크립트는 매우 훌륭하지만 데이터가 RTD 서버를 통해 직접 엑셀로 이동하여 엑셀의 RDTR 기능을 사용할 수 있으면 더 좋겠습니다. 그런 기능을 염두에 두고 계신가요?
xm.cm real14
 

네, 작동합니다. ...MQL5\Files 경로를 확인하면 CSV 파일이 있습니다.

아래 코드를 변경하여 OBV(실제 볼륨) 값을 저장하도록 수정했습니다.


Indicator_Directory_And_Name="Examples\\OBV";
IndicatorPeriod=VOLUME_REAL;
 
Ecirba:

안녕하세요,

안녕하세요. 안타깝게도 스크립트를 실행하면 파일이 생성되지 않습니다. C:/temp/에 작성하도록 스크립트를 업데이트했습니다. 디버그에서 실행하면 파일 이름이 정확하고 오류가 발생하지 않지만 파일이 없다는 것을 알 수 있습니다.

어떤 단서가 있습니까?


핸들을 확인하면 아마도 -1을 반환 할 것입니다. (잘못된 핸들)


Print ( "fileHandle Value=", fileHandle);


어떤 이유로 MT5는 기본값과 다른 위치에 파일을 저장하는 것을 좋아하지 않습니다. 그냥 원본 코드로 두면 ...MQL5 \ 파일 경로에 기록됩니다.

 

스크립트에서 변동성 피벗 플래그의 값을 CSV로 내보내고 있지만 스크립트가 높은 값만 올바르게 내보내고 낮은 값이 표시되어야하는 줄에 오류가 나타납니다.

누군가 제발 도와줄 수 있나요?

변동성 피벗 스크립트

#property indicator_chart_window
//--- 계산 및 표시기 그리기에 4개의 버퍼가 사용됩니다.
#property indicator_buffers 4
//--- 4개의 플롯이 사용됩니다.
#property indicator_plots   4
//+----------------------------------------------+
//| 강세 지표 그리기 매개 변수 |
//+----------------------------------------------+
//--- 표시기 1을 선으로 그리기
#property indicator_type1   DRAW_LINE
//--- 파란색은 표시줄에 사용됩니다.
#property indicator_color1  clrBlue
//--- 표시기 1줄은 점-대시 표시기입니다.
#property indicator_style1  STYLE_DASHDOTDOT
//--- 표시기 1 줄 너비는 2와 같습니다.
#property indicator_width1  2
//---- 표시 라벨 표시
#property indicator_label1  "Upper VolatilityPivot"
//+----------------------------------------------+
//| 약세 지표 그리기 매개변수 ||
//+----------------------------------------------+
//--- 표시기 2를 선으로 그리기
#property indicator_type2   DRAW_LINE
//--- 표시줄에 핫핑크 색상이 사용됩니다.
#property indicator_color2  clrHotPink
//--- 표시기 2 줄은 점선 대시입니다.
#property indicator_style2  STYLE_DASHDOTDOT
//--- 표시기 2 줄 너비는 2와 같습니다.
#property indicator_width2  2
//---- 표시 라벨 표시
#property indicator_label2  "Lower VolatilityPivot"
//+----------------------------------------------+
//| 강세 지표 그리기 매개 변수 |
//+----------------------------------------------+
//--- 표시기 3을 레이블로 그리기
#property indicator_type3   DRAW_ARROW
//--- 표시기에는 DeepSkyBlue 색상이 사용됩니다.
#property indicator_color3  clrDeepSkyBlue
//--- 표시기 3 너비는 4와 같습니다.
#property indicator_width3  4
//--- 표시기 레이블 표시
#property indicator_label3  "Buy VolatilityPivot"
//+----------------------------------------------+
//| 약세 지표 그리기 매개변수 ||
//+----------------------------------------------+
//--- 표시기 4를 레이블로 그리기
#property indicator_type4   DRAW_ARROW
//--- 빨간색은 표시기에 사용됩니다.
#property indicator_color4  clrRed
//--- 표시기 4 너비는 4와 같습니다.
#property indicator_width4  4
//--- 표시기 레이블 표시
#property indicator_label4  "Sell VolatilityPivot"
//+----------------------------------------------+
//| 상수 선언 |
//+----------------------------------------------+
#define  RESET 0  // 표시기 재계산 명령을 터미널에 반환하는 상수입니다.
//+----------------------------------------------+
//| 열거 선언 |
//+----------------------------------------------+
enum Mode_
  {
   Mode_ATR=0,   //ATR
   Mode_Price    //가격 편차
  };
//+----------------------------------------------+
//| 표시기 입력 매개변수 |
//+----------------------------------------------+
input uint   atr_range=100;
input uint   ima_range=10;
input double atr_factor=3;
input Mode_  Mode=Mode_ATR;
input  uint  DeltaPrice=200;
input int    Shift=0;          // 막대 표시기의 수평 이동
//+----------------------------------------------+
//--- 동적 배열을 선언하는 경우
//---는 표시기 버퍼로 사용됩니다.
double ExtMapBufferUp[];
double ExtMapBufferDown[];
double ExtMapBufferUp1[];
double ExtMapBufferDown1[];
//---
double dDeltaPrice;
//--- 인디케이터 핸들을 위한 정수 변수 선언
int ATR_Handle;
//--- 데이터 계산 시작을 위한 정수 변수 선언
int min_rates_total;
//+------------------------------------------------------------------+
//| CMoving_Average 클래스 설명|
//+------------------------------------------------------------------+
#include <SmoothAlgorithms.mqh>
//+------------------------------------------------------------------+
//| 사용자 지정 표시기 초기화 기능 |
//+------------------------------------------------------------------+ 
int OnInit()
  {
//--- ATR 표시기의 핸들 가져오기
   if(Mode==Mode_ATR)
     {
      min_rates_total=int(atr_range+ima_range)+1;
      ATR_Handle=iATR(NULL,0,atr_range);
      if(ATR_Handle==INVALID_HANDLE)
        {
         Print(" Failed to get handle of the ATR indicator");
         return(INIT_FAILED);
        }
     }
   else
     {
      min_rates_total=3;
      dDeltaPrice=DeltaPrice*_Point;
     }
//--- 표시기 버퍼로 익스맵버퍼업[] 동적 배열을 설정합니다.
   SetIndexBuffer(0,ExtMapBufferUp,INDICATOR_DATA);
//---- Shift 키를 눌러 표시기 1을 가로로 이동합니다.
   PlotIndexSetInteger(0,PLOT_SHIFT,Shift);
//--- 인디케이터 그리기 시작점 이동 1
   PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,min_rates_total);
//--- 버퍼 요소를 시계열로 인덱싱하기 
   ArraySetAsSeries(ExtMapBufferUp,true);
//--- 차트에 표시되지 않을 지표 값 설정
   PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,EMPTY_VALUE);
//--- 표시기 버퍼로 익스맵버퍼다운[] 동적 배열을 설정합니다.
   SetIndexBuffer(1,ExtMapBufferDown,INDICATOR_DATA);
//---- Shift 키를 눌러 표시기 2를 가로로 이동합니다.
   PlotIndexSetInteger(1,PLOT_SHIFT,Shift);
//--- 표시기 그리기 계산 시작점 이동 2
   PlotIndexSetInteger(1,PLOT_DRAW_BEGIN,min_rates_total);
//--- 버퍼 요소를 시계열로 인덱싱하기 
   ArraySetAsSeries(ExtMapBufferDown,true);
//--- 차트에 표시되지 않을 지표 값 설정
   PlotIndexSetDouble(1,PLOT_EMPTY_VALUE,EMPTY_VALUE);
//--- 익스맵버퍼업1[] 동적 배열을 인디케이터 버퍼로 설정합니다.
   SetIndexBuffer(2,ExtMapBufferUp1,INDICATOR_DATA);
//---- Shift 키를 눌러 표시기 1을 가로로 이동합니다.
   PlotIndexSetInteger(2,PLOT_SHIFT,Shift);
//--- 인디케이터의 그리기 시작점 이동 3
   PlotIndexSetInteger(2,PLOT_DRAW_BEGIN,min_rates_total);
//--- 버퍼 요소를 시계열로 인덱싱하기 
   ArraySetAsSeries(ExtMapBufferUp1,true);
//--- 차트에 표시되지 않을 지표 값 설정
   PlotIndexSetDouble(2,PLOT_EMPTY_VALUE,EMPTY_VALUE);
//--- 표시기 기호
   PlotIndexSetInteger(2,PLOT_ARROW,118);
//--- 익스맵버퍼다운1[] 동적 배열을 인디케이터 버퍼로 설정합니다.
   SetIndexBuffer(3,ExtMapBufferDown1,INDICATOR_DATA);
//---- Shift 키를 눌러 표시기 2를 가로로 이동합니다.
   PlotIndexSetInteger(3,PLOT_SHIFT,Shift);
//--- 인디케이터의 그리기 시작점 이동 4
   PlotIndexSetInteger(3,PLOT_DRAW_BEGIN,min_rates_total);
//--- 버퍼 요소를 시계열로 인덱싱하기 
   ArraySetAsSeries(ExtMapBufferDown1,true);
//--- 차트에 표시되지 않을 지표 값 설정
   PlotIndexSetDouble(3,PLOT_EMPTY_VALUE,EMPTY_VALUE);
//--- 표시기 기호
   PlotIndexSetInteger(3,PLOT_ARROW,118);
//--- 별도의 하위 창과 팝업 도움말에 표시할 이름을 만듭니다.
   IndicatorSetString(INDICATOR_SHORTNAME,"VolatilityPivot");
//--- 표시기 값의 정확도 결정
   IndicatorSetInteger(INDICATOR_DIGITS,_Digits);
//--- 초기화 종료
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| 사용자 지정 인디케이터 반복 함수|
//+------------------------------------------------------------------+
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[])
  {
//--- 막대 개수가 계산에 충분한지 확인
   if((BarsCalculated(ATR_Handle)<rates_total && Mode==Mode_ATR) || rates_total<min_rates_total) return(RESET);
//--- 지역 변수 선언 
   double DeltaStop,Stop;
   static double PrevStop;
   int limit,bar;
//--- 시계열에서와 같이 배열의 요소 인덱싱하기 
   ArraySetAsSeries(close,true);
//--- 막대 재계산 루프에 대한 'limit' 시작 인덱스 계산
   if(prev_calculated>rates_total || prev_calculated<=0) // 지표의 첫 번째 계산 시작을 확인합니다.
     {
      limit=rates_total-min_rates_total-1;               // 모든 막대 계산을 위한 시작 인덱스
      PrevStop=close[limit+1];
     }
   else limit=rates_total-prev_calculated;               // 새 막대 계산을 위한 시작 인덱스
//---
   if(Mode==Mode_Price)
     {
      //--- 주 지표 계산 루프
      for(bar=limit; bar>=0; bar--)
        {
         ExtMapBufferUp1[bar]=EMPTY_VALUE;
         ExtMapBufferDown1[bar]=EMPTY_VALUE;
         DeltaStop=dDeltaPrice;
         //---
         if(close[bar]==PrevStop) Stop=PrevStop;
         else
           {
            if(close[bar+1]<PrevStop && close[bar]<PrevStop) Stop=MathMin(PrevStop,close[bar]+DeltaStop);
            else
              {
               if(close[bar+1]>PrevStop && close[bar]>PrevStop) Stop=MathMax(PrevStop,close[bar]-DeltaStop);
               else
                 {
                  if(close[bar]>PrevStop) Stop=close[bar]-DeltaStop;
                  else Stop=close[bar]+DeltaStop;
                 }
              }
           }
         //---
         if(close[bar]>Stop) ExtMapBufferUp[bar]=Stop; else ExtMapBufferUp[bar]=EMPTY_VALUE;
         if(close[bar]<Stop) ExtMapBufferDown[bar]=Stop; else ExtMapBufferDown[bar]=EMPTY_VALUE;
         if(ExtMapBufferUp[bar+1]==EMPTY_VALUE && ExtMapBufferUp[bar]!=EMPTY_VALUE) ExtMapBufferUp1[bar]=ExtMapBufferUp[bar];
         if(ExtMapBufferDown[bar+1]==EMPTY_VALUE && ExtMapBufferDown[bar]!=EMPTY_VALUE) ExtMapBufferDown1[bar]=ExtMapBufferDown[bar];
         if(bar) PrevStop=Stop;
        }
     }
//---
   if(Mode==Mode_ATR)
     {
      //--- 지역 변수 선언 
      double ATR[];
      int to_copy,maxbar;
      SmoothAlgorithms.mqh 파일에서 CMoving_Average 클래스 변수의 //--- 선언입니다. 
      static CMoving_Average EMA;
      //--- 시계열에서와 같이 배열의 요소 인덱싱하기 
      ArraySetAsSeries(ATR,true);
      to_copy=limit+1;
      if(CopyBuffer(ATR_Handle,0,0,to_copy,ATR)<=0) return(RESET);
      maxbar=rates_total-min_rates_total-1;
      //--- 주 지표 계산 루프
      for(bar=limit; bar>=0; bar--)
        {
         ExtMapBufferUp1[bar]=EMPTY_VALUE;
         ExtMapBufferDown1[bar]=EMPTY_VALUE;
         DeltaStop=atr_factor*EMA.EMASeries(maxbar,prev_calculated,rates_total,ima_range,ATR[bar],bar,true);
         //---
         if(close[bar]==PrevStop) Stop=PrevStop;
         else
           {
            if(close[bar+1]<PrevStop && close[bar]<PrevStop) Stop=MathMin(PrevStop,close[bar]+DeltaStop);
            else
              {
               if(close[bar+1]>PrevStop && close[bar]>PrevStop) Stop=MathMax(PrevStop,close[bar]-DeltaStop);
               else
                 {
                  if(close[bar]>PrevStop) Stop=close[bar]-DeltaStop;
                  else Stop=close[bar]+DeltaStop;
                 }
              }
           }
         //---
         if(close[bar]>Stop) ExtMapBufferUp[bar]=Stop; else ExtMapBufferUp[bar]=EMPTY_VALUE;
         if(close[bar]<Stop) ExtMapBufferDown[bar]=Stop; else ExtMapBufferDown[bar]=EMPTY_VALUE;
         //---
         if(ExtMapBufferUp[bar+1]==EMPTY_VALUE && ExtMapBufferUp[bar]!=EMPTY_VALUE) ExtMapBufferUp1[bar]=ExtMapBufferUp[bar];
         if(ExtMapBufferDown[bar+1]==EMPTY_VALUE && ExtMapBufferDown[bar]!=EMPTY_VALUE) ExtMapBufferDown1[bar]=ExtMapBufferDown[bar];
         //---
         if(bar) PrevStop=Stop;
        }
     }
//--- 
   return(rates_total);
  }

CSV 오류

 

이것은 매우 유용합니다.

저자는 황소입니다.