2 registered members (dr_panther, 7th_zorro),
1,203
guests, and 2
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Multi time frame trading
[Re: byakuren81]
#468392
10/02/17 21:28
10/02/17 21:28
|
Joined: Jan 2014
Posts: 86 London City
byakuren81
OP
Junior Member
|
OP
Junior Member
Joined: Jan 2014
Posts: 86
London City
|
void write(string name, int tf) { string Format = "n%s,%.5f,%.5f,%.5f,%.5f"; char FileName[40]; TimeFrame = frameSync(tf);
vars open = series(priceOpen()); vars high = series(priceHigh()); vars low = series(priceLow()); vars close = series(priceClose()); sprintf(FileName,name,strx(Asset,"/","")); // remove slash from forex pairs if(is(INITRUN)) file_write(FileName,"Date,Open,High,Low,Close",0); else if (frame(0)) file_append(FileName,strf(Format, strdate("%Y-%m-%d %H:%M"), open[0], high[0], low[0], close[0])); }
function run() { BarPeriod = 1; StartDate = 20170103; EndDate = 20170331; write("History\%s_H1.csv",60);
write("History\%s_H4.csv",240); }
|
|
|
Re: Multi time frame trading
[Re: jcl]
#468413
10/03/17 14:31
10/03/17 14:31
|
Joined: Feb 2017
Posts: 1,729 Chicago
AndrewAMD
Serious User
|
Serious User
Joined: Feb 2017
Posts: 1,729
Chicago
|
You would then get one wrong bar in any of your time frames. Price history stores M1 ticks by their close time, not their start time. If you still want to offset bars for some reason, use the TickFix variable. This is interesting to me because the Ally broker API gives me the start time of the period, and I just used that for the field in my plugin, which now appears to be incorrect. So I should add BarPeriod/1440.0 to the DATE value, correct? Expect an update from me soon.
|
|
|
Re: Multi time frame trading
[Re: jcl]
#468415
10/03/17 14:53
10/03/17 14:53
|
Joined: Feb 2017
Posts: 1,729 Chicago
AndrewAMD
Serious User
|
Serious User
Joined: Feb 2017
Posts: 1,729
Chicago
|
But make sure before that Ally really returns the tick start time in their API, because this is unusual. Most prices sources return the time when the tick was sampled. I did not know this. GET market/timesales:"The datetime field will indicate the start time of an interval (for example: 09:25 will represent the interval from 09:25 to 09:30)." I guess that Ally is an unusual broker. And I did not implement ticks because I cannot get it to work. So that saves me a step.
|
|
|
|