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<string> datalist = new List<string>(); for(int bar = 0; bar < Bars.Count; bar++) { string csv = Date[bar].ToString(dtefmt) + sep + Open[bar].ToString(fmt) + sep + High[bar].ToString(fmt) + sep + Low[bar].ToString(fmt) + sep + Close[bar].ToString(fmt) + sep + Volume[bar].ToString("0"); datalist.Add(csv); } File.WriteAllLines(file, datalist); RestoreContext(); PrintStatusBar("Complete!"); } }
... // + Volume[bar].ToString("0"); + Volume[bar].ToString("0") + sep + RSI.Series(Close, 14)[bar].ToString(fmt); ...
... csv.WriteLine( Date[bar].ToString("yyyyMMdd") + ...