using System; using System.Collections.Generic; using System.Text; using WealthLab; using System.IO;public class Export2ASCII : WealthScript { protected override void Execute() { const string sep = ","; const string fmt = "0.00########"; string dtefmt = "yyyyMMdd"; if( Bars.BarInterval > 0 ) dtefmt = "yyyyMMdd HHmm"; string path = @"C:\Data\ASCII\"; if (!Directory.Exists(path)) throw new Exception("You must create the directory " + path); PrintStatusBar("Exporting: " + Bars.Symbol); string file = path + Bars.Symbol + ".csv"; List datalist = new List(); for(int bar = 0; bar < Bars.Count; bar++) { string csv = Datebar.ToString(dtefmt) + sep + Openbar.ToString(fmt) + sep + Highbar.ToString(fmt) + sep + Lowbar.ToString(fmt) + sep + Closebar.ToString(fmt) + sep + Volumebar.ToString("0"); datalist.Add(csv); } File.WriteAllLines(file, datalist); RestoreContext(); PrintStatusBar("Complete!"); } }
... // + Volumebar.ToString("0"); + Volumebar.ToString("0") + sep + RSI.Series(Close, 14)bar.ToString(fmt); ...
... csv.WriteLine( Datebar.ToString("yyyyMMdd") + ...