PureBytes Links
Trading Reference Links
|
> I don't need TS to do the analysis, I just need TS to
> create those longer time period price bars.
Simple to do. Just write EL that dumps the bars to a file.
Something along these lines: (not tested)
inputs: Period(1), OutFile("C:\bars.csv");
vars: NewBar(False), OO(0), HH(0), LL(999999);
NewBar = (Period = 1
and Month(Date) <> Month(Date[1])
and mod(Month(Date[1]),3) = 0)
or (Period = 2
and Year(Date) <> Year(Date[1]))
or (Period = 3
and mod(Year(Date[1]), 5) = 0);
if NewBar or LastBarOnChart then begin
FileAppend(OutFile,
NumToStr(Date,0) + "," +
NumToStr(OO,2) + "," +
NumToStr(HH,2) + "," +
NumToStr(LL,2) + "," +
NumToStr(Close[1],2) + "," + newline);
OO = Open;
HH = 0;
LL = 999999;
end;
HH = MaxList(HH, High);
LL = MinList(LL, Low);
If you want the volume &etc too, you'll have to add that up as
you go along. You might also need to change the "digits after
decimal point" argument to NumToStr as required by your data.
The NewBar code determines when a bar has closed, depending on
your desired period: 1 = quarterly, 2 = yearly, 3 = 5year. You
can modify it for other periods.
Gary
|