//+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- start(); //---- return ( 0 ); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return ( 0 ); } void export () { string file= "export_" + Symbol ()+ "_" + Period ()+ ".csv" ; int f= FileOpen (file, FILE_CSV | FILE_WRITE , "," ); if (f< 1 ) { Alert ( "File opening error" ); return ( 0 ); } for ( int i= Bars - 1 ;i<= 0 ;i--) { FileWrite (f,TimeToStr(Time,TIME_DATE|TIME_MINUTES),Open,High,Low,Close , iFractals ( Symbol (), 0 , 1 ,i), iFractals ( Symbol (), 0 , 2 ,i), iCustom ( Symbol (), 0 , "ZigZag" , 0 ,i), iCustom ( Symbol (), 0 , "ZigZag" , 1 ,i)); } Alert ( "Export " + Symbol ()+ " finished. Exported: " + Bars + " records" ); FileFlush (f); FileClose (f); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { export (); //---- //Alert(ArraySize(norepeats) + ArraySize(morerepeats)); return ( 0 ); } //+------------------------------------------------------------------+
포럼 검색을 이용하세요. . .
https://www.mql5.com/en/forum/147170
. . . 그리고 문서
이런 식으로 결합했는데 오류가 발생합니다. 데이터 없이 파일을 받는 이유를 이해하지 못함
//#property copyright "" //#property link "" //+------------------------------------------------------------------+ //| script program start function | //+------------------------------------------------------------------+ int start() { export (); } //+------------------------------------------------------------------+ void export () { string file= "export_" + Symbol ()+ "_" + Period ()+ ".csv" ; int f= FileOpen (file, FILE_CSV | FILE_READ , "," ); if (f< 1 ) { Alert ( "File opening error" ); return ( 0 ); } for ( int i= Bars - 1 ;i<= 0 ;i--) { FileWrite (f,TimeToStr(Time,TIME_DATE|TIME_MINUTES),Open,High,Low,Close , iFractals ( Symbol (), 0 , 1 ,i), iFractals ( Symbol (), 0 , 2 ,i), iCustom ( Symbol (), 0 , "ZigZag" , 0 ,i), iCustom ( Symbol (), 0 , "ZigZag" , 1 ,i)); } Alert ( "Export " + Symbol ()+ " finished. Exported: " + Bars + " records" ); FileFlush (f); FileClose (f); }
1) >=
for ( int i= Bars - 1 ;i <= 0 ;i--)
2) FILE_WRITE 또는 파일_읽기| 파일_쓰기
FileOpen (file, FILE_CSV | FILE_READ , "," );
3) EMPTY_VALUE 에 대해 알고 있습니까(ZZ 및 프랙탈에 있을 수 있음) ??? (빈 값은 DataWindow에 그려지거나 표시되지 않습니다. 기본적으로 빈 값은 EMPTY_VALUE입니다)
4) 파일을 닫을 때 데이터가 자동으로 디스크에 플러시되므로 FileClose() 함수를 호출하기 전에 FileFlush() 함수를 호출할 필요가 없습니다 .
나는 그러한 변경을 했고, 파일은 나에게 단 한 가지 사실만을 알려준다:
나는 더 이상 아무것도 생각할 수 없다
//#property copyright "" //#property link "" //+------------------------------------------------------------------+ //| script program start function | //+------------------------------------------------------------------+ int start() { export (); } //+------------------------------------------------------------------+ void export () { string file= "export_" + Symbol ()+ "_" + Period ()+ ".csv" ; int f= FileOpen (file, FILE_READ | FILE_WRITE , "," ); if (f< 1 ) { Alert ( "File opening error" ); return ( 0 ); } for ( int i= Bars - 1 ;i>= 0 ;i--) { FileWrite (f,TimeToStr(Time,TIME_DATE|TIME_MINUTES),Open,High,Low,Close , iFractals ( Symbol (), 0 , 1 ,i), iFractals ( Symbol (), 0 , 2 ,i), iCustom ( Symbol (), 0 , "ZigZag" , 0 ,i), iCustom ( Symbol (), 0 , "ZigZag" , 1 ,i)); FileClose (f); } Alert ( "Export " + Symbol ()+ " finished. Exported: " + Bars + " records" ); FileClose (f); }
나는 그러한 변경을 했고, 파일은 나에게 단 한 가지 사실만을 알려준다:
나는 더 이상 아무것도 생각할 수 없다
파일을 열면 파일에 쓰고 닫은 다음 다시 열어 새 데이터가 기록될 데이터를 추가로 쓰십시오. 파일의 어떤 위치에 있습니까?
코드에서 올바른 단계를 사용한다고 생각합니다. 모든 데이터를 파일로 다운로드해야 한다고 생각합니다. CSV,하지만 내가 왜 이것을하는지 이해하지 못합니다.
나는 전문가, 다소 유사한 코드를 만들려고 시도하고 월별 데이터와 같은 파일을 작성합니다.
1970.01.01 00:00,,,,,,0,0,0,2147483647
1970.01.01 00:00,,,,,,0,0,0,2147483647
1970.01.01 00:00,,,,,,0,0,0,2147483647
1970.01.01 00:00,,,,,,0,0,0,2147483647
1970.01.01 00:00,,,,,,0,1.1614,0,2147483647
1970.01.01 00:00,,,,,,0,0,0,2147483647
1970.01.01 00:00,,,,,,0,0,0,2147483647
1970.01.01 00:00,,,,,,0,0,0,2147483647
1970.01.01 00:00,,,,,,0,0,0,2147483647
1970.01.01 00:00,,,,,,0,0,0,2147483647
1970.01.01 00:00,,,,,,1.4104,0,0,2147483647
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,,0,1.1688,0,0
1970.01.01 00:00,,,,,,1.2495,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,,0,1.1192,0,0
1970.01.01 00:00,,,,,,1.2315,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,1.1069,1.1069,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,,1.2894,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,,1.3161,0,0,1.3161
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,1.2351,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,,1.4535,0,1.4535,1.4535
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,,0,1.3,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,,1.3353,1.2596,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,,0,1.0344,1.0344,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,,1.1537,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,,0,1.0608,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,,1.1216,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,,0,1.079,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,0,0,0,0
1970.01.01 00:00,,,,,,1.2401,0,1.2401,1.2401
그러나 더 이상 1970년 데이터를 다운로드하지 않습니다.
우리가 사용한 코드는 다음과 같습니다.
//+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- start(); //---- return ( 0 ); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return ( 0 ); } void export () { string file= "export_" + Symbol ()+ "_" + Period ()+ ".csv" ; int f= FileOpen (file, FILE_CSV | FILE_WRITE , "," ); if (f< 1 ) { Alert ( "File opening error" ); return ( 0 ); } for ( int i= Bars - 1 ;i>= 0 ;i--) { FileWrite (f,TimeToStr(Time,TIME_DATE|TIME_MINUTES),Open,High,Low,Close , iFractals ( Symbol (), 0 , 1 ,i), iFractals ( Symbol (), 0 , 2 ,i), iCustom ( Symbol (), 0 , "ZigZag" , 0 ,i), iCustom ( Symbol (), 0 , "ZigZag" , 1 ,i)); } Alert ( "Export " + Symbol ()+ " finished. Exported: " + Bars + " records" ); FileClose (f); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { export (); //---- //Alert(ArraySize(norepeats) + ArraySize(morerepeats)); return ( 0 ); } //+------------------------------------------------------------------+
코드에서 올바른 단계를 사용한다고 생각합니다. 모든 데이터를 파일로 다운로드해야 한다고 생각합니다. CSV,하지만 내가 왜 이것을하는지 이해하지 못합니다.