jaja. folks, my first post was too extensive, let me try again. i think it is important to always be polite when asking for help and to fully communicate one's motivations, so one liners would not be the best vehicle to do this but i will adapt to how things are done in this forum. chances are it will be helpful to split my question into modules.
- i have this piece of code in easylanguage that generates one unique text file with a unique filename every time one of four different types of events takes place (every individual text file serves as its own separate log entry). i need to convert this code to c# (i will use this code inside the ninjatrader trading platform), using streamwriter ot any other c# solutions that would allow me to generate unique text files with filenames created dynamically that would include some string inputs, variables and date and time with a similar format to the following:
// pass in a string containing line to be written to the file
method void recordevent(string msg)
variables:
string filepath;
begin
// create file name, including a directory based upon the symbol
//
// note: symbol should not contain characters that are not valid in file names
// indicator name should not contain invalid characters for a file name
// add whatever other parameters desired
filepath = string.format("{0}\{1}_{2}_{3:yyyyMMddhhmmss}_{4}_{5}.txt",
iprimarydirectory,
filnamplusymtic,
gronam,
datetime.now,
casnum,
numtostr(price,2));
print(filepath);
sw = streamwriter.create(filepath);
sw.autoflush = true;
sw.writeline(msg);
sw.close();
end;
[note: primary directory, file name plus symbol ticker and group name are string inputs to be defined by the user while case number is a string variable to be calculated by the program. i use this information to make sure filenames are unique and to keep files sorted by symbol ticker and time they were generated.]
very well, i hope this version of my initial question will be more understandable and manageable. thanks to all, regards.