//+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| 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 ); } //+------------------------------------------------------------------+
Lütfen Forum aramasını kullanın. . .
https://www.mql5.com/en/forum/147170
. . . ve belgeler
Bu şekilde birleştirdim ve bana hata veriyor. Dosyayı neden herhangi bir veri olmadan aldığımı anlamıyorum
//#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 veya DOSYA_OKUYUN| FILE_WRITE
FileOpen (file, FILE_CSV | FILE_READ , "," );
3) EMPTY_VALUE hakkında bilginiz var mı (ZZ ve Fraktallar buna sahip olabilir) ??? (Boş değerler DataWindow'da çizilmez veya gösterilmez. Varsayılan olarak boş değer EMPTY_VALUE'dir)
4) Dosya kapatılırken, veriler otomatik olarak diske aktarılır, bu nedenle FileClose() işlevini çağırmadan önce FileFlush() işlevini çağırmaya gerek yoktur .
Bu değişiklikleri yaptım ve dosya bana sadece bir gerçek veriyor:
başka bir şey düşünemiyorum
//#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); }
Bu değişiklikleri yaptım ve dosya bana sadece bir gerçek veriyor:
başka bir şey düşünemiyorum
Bu konuyu açmadan birkaç saat önce
sizin konunuzla birlikte başka bir konu daha açıldı
okumadın mı?? Grafik verilerini dosyaya kaydetme
Bir dosyayı açarsanız, ona yazın, kapatın ve ardından biraz daha veri yazmak için tekrar açın yeni veriler nereye yazılacak? dosyanın neresinde?
Kodda, doğru adımları kullandığımı düşünüyorum. Bence tüm verileri bir dosyada indirmelisiniz. Csv, ama bunu neden yaptığımı anlamıyorum.
Bir uzman, aşağı yukarı benzer kod oluşturmayı denedim ve örneğin aylık veriler gibi bir dosya yazdım
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.2401,1.2401
Ama artık 1970'ten veri indirme yok.
Kullandığımız kod şu şekildeydi:
//+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| 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 ); } //+------------------------------------------------------------------+
Kodda, doğru adımları kullandığımı düşünüyorum. Bence tüm verileri bir dosyada indirmelisiniz. Csv, ama bunu neden yaptığımı anlamıyorum.
- Ücretsiz alım-satım uygulamaları
- İşlem kopyalama için 8.000'den fazla sinyal
- Finansal piyasaları keşfetmek için ekonomik haberler
Gizlilik ve Veri Koruma Politikasını ve MQL5.com Kullanım Şartlarını kabul edersiniz