multicharts date in file name  [SOLVED]

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

multicharts date in file name

Postby waldem » 11 Dec 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: 18 Nov 2013
Has thanked: 3 times
Been thanked: 4 times

Re: multicharts date in file name

Postby waldem » 11 Dec 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: 7752
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2228 times

Re: multicharts date in file name

Postby TJ » 11 Dec 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: 522
Joined: 03 Dec 2010
Location: Thailand
Has thanked: 99 times
Been thanked: 125 times

Re: multicharts date in file name

Postby Smoky » 11 Dec 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: 18 Nov 2013
Has thanked: 3 times
Been thanked: 4 times

Re: multicharts date in file name  [SOLVED]

Postby waldem » 12 Dec 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";


Return to “MultiCharts”