[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: File Append function issues



PureBytes Links

Trading Reference Links

Hi Paul,

Problem with - Vars:Name(String)  This needs be Name("").  The "" will
allow any string value to be Name. This looks like what you are trying
to do.

Also TS does not recognize the word Symbol so you need to add That word
to the Vars: - Like Vars:Symbol("XYZ").

Changing your code to
Vars:Name(""),Symbol("XYZ");
will verify

However I think that TS GetSymbolName is more what you are looking for.
This should get the Symbol automatically.

So now Vars:Name(""),Symbol(GetSymbolName); - should work.  This also
will verfy.

As to the rest - you'll have to test that out to see if it gives you
what you are looking for.

Larry


Paul wrote:
> 
> Hi All,
> 
> I am trying to figure out the file append function.
> 
> I am trying to create a metastock ascii file with the following format
> <date>, <time>, <open>, <high>, <low>, <close>, <volume>
> <yyyymmdd>, <HH:MM>, <open>, <high>, <low>, <close>, <upticks + downticks>
> 
> and I want it to export to the "C:\TSdata\" directory
> 
> and I want the file name to be
> <symbol>_lastbaronchartDATE_lastbaronchartTME.csv
> 
> I have included what I have done below but it does not verify. Would
> someone mind having a look at the code and see where I maybe going wrong.
> 
> Thanks
> Paul
> 
> { <><><> START CODE <><><>}
> Inputs: DIR("c:\TSdata\"), Decimalz(2);
> 
> Vars: Name(String);
> 
> If LastBaronChart then Name = (Symbol + NumToStr(1900+year(date),0) +
>   NumToStr(month(date),0) +
>   NumToStr(FracPortion(date/100)*100,0) + "_" +
> 
>   NumToStr(IntPortion(TIME/100),0) +
>   NumToStr(FracPortion(TIME/100)*100,0));
> 
> If currentbar >= 1 then FileAppend(DIR+name +".csv",
>   NumToStr(1900+year(date),0) +
>   NumToStr(month(date),0) +
>   NumToStr(FracPortion(date/100)*100,0) + "," +
> 
>   NumToStr(IntPortion(TIME/100),0) + ":" +
>   NumToStr(FracPortion(TIME/100)*100,0) + "," +
> 
>   NumToStr(Open,Decimalz) + "," +
>   NumToStr(High,Decimalz) + "," +
>   NumToStr(Low,Decimalz) + "," +
>   NumToStr(Close,Decimalz) + "," +
>   NumToStr(Upticks + Downticks,0) + "," + newline );
> 
> if c<> c then plot1(1," ");
> 
> {<><><> END CODE <><><>}