multicharts date in file name  [SOLVED]

Questions about MultiCharts and user contributed studies.
waldem
Posts: 115
Joined: Nov 18 2013
Has thanked: 3 times
Been thanked: 4 times

Dec 11 2019

Hallo, when i export a txt file should be possible to format the name including the date?
today i have one initial variable like this: FName = "C:\Temp\CheckList.TXT";
Should be possible to append the date somehow?

waldem
Posts: 115
Joined: Nov 18 2013
Has thanked: 3 times
Been thanked: 4 times

Dec 11 2019

i tried to solve like this FName3 = "C:\Temp\CheckList_BLSH"+datetostring(date)+".txt";
but i got error because i cannot create file with special character "/"
any idea?

User avatar
TJ
Posts: 7765
Joined: Aug 29 2006
Location: Global Citizen
Has thanked: 1036 times
Been thanked: 2232 times

Dec 11 2019

i tried to solve like this FName3 = "C:\Temp\CheckList_BLSH"+datetostring(date)+".txt";
but i got error because i cannot create file with special character "/"
any idea?
Have you checked the Wiki for usage examples of datetostring ?

User avatar
Smoky
Posts: 524
Joined: Dec 03 2010
Location: Thailand
Has thanked: 99 times
Been thanked: 125 times

Dec 11 2019

function to setup file name "SUFIXELOG"

Code: Select all

INPUT: MasterName(string); var: TempName(""), dat(""),heur(""); dat = NumToStr(currentdate,0); heur = NumToStr(currentTime,0); TempName= "C:\CSV\"+ MasterName+ "." + dat +"."+ heur +".csv"; SUFIXELOG=TempName;
calling code:

Code: Select all

var: filename("tradelog"), Field("name;price;win"); once begin filename=SUFIXELOG(filename); end; print(file(filename),Field);
working well...

waldem
Posts: 115
Joined: Nov 18 2013
Has thanked: 3 times
Been thanked: 4 times

Dec 12 2019

Thanks Smoky, but as suggested by TJ is easy to read wiky.
I used FormatDate function and it works:
FName3 = "C:\Temp\CheckList"+FormatDate("dd-MM-yy",MyDate)+".txt";