Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 12/30/2005(UTC) Posts: 120
|
H1:=10; {hour}
M1:=0; {minute}
Trading market is opened at 10 am,
I am using a moving average crossover to triggering any signal, but I don't want to use previous day's data to calculate the moving average, so if C > Mov(C,9,S) in 1 minute chart, then I would assume the market will be opened at 10:09 am, I need to test this strategy in system tester using OPT for number of minutes, but I get no idea on how to add this number of minutes into 10 am, which will be restricted any signal before that. Since hour and minute are defined separately, does anyone have any suggestions on how to code the opening time period to restrict any signal?
Thanks in advance for any suggestions
Eric
Buy: If current time > opening time AND Cross(C,Mov(C,9,S))
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
Hi oem
Here are a couple of options you could try.
(Hour()>10 OR Hour()=10 AND Minute()>=9) AND Cross(C,Mov(C,9,S)) ;
D:=DayOfWeek();
BarsSince(D<>Ref(D,-1))>=8 AND Cross(C,Mov(C,9,S));
The numbers you use for the first option could vary depending on whether the first minute of each day is time stamped as 10.00 or 10.01. There are probably several other solutions that would work equally well anwhich way you choose to go might depend on other considerations that weren't included in your question.
Roy
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 12/30/2005(UTC) Posts: 120
|
I would like to test the strategy with OPT value from 1 to 100 minutes, so the time for opening market will be different with different OPT. Market will be opened at 10 am, so the first minute bar will be completed at 10:01 am.
For example, when the OPT is 3, then it will take the first 3 minutes to calculate the moving average, so I only consider any buy signal after 10:03 am, if buy signal is triggered at 10:04 am, which meet the condition that the calculation on MA does not include any previous day's data.
On the other hand, when the OPT is 80, then it will take the first 80 minutes to calculate the moving average, so I only consider any buy signal after 11:20 am, if buy signal is triggered at 10:30 am, which does not meet the condition, because the calculation on MA includes previous day's data, then this buy signal will be ignored.
If buy signal is triggered at 11:30 am, which meet the condition that the calculation on MA does not include any previous day's data, then this buy signal will be accepted.
Do you have any suggestions?
Thanks in advance for any suggestions
Eric
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
Hi Eric
One way would be to create a “minute” counter.
MC:=Hour()*60 +Minute();
This will give you a specific value for any given time of the day. By adding OPT to the start time value of the counter you’ll have a value above which your buy signals become enabled. One issue you’d need to watch out for (I’m not sure if it’s relevant because I don’t have a real-time feed) is bars that are missed, deleted or just not present when no trades occur during any given minute. If that happened, a minute counter would not increment at the same rate as a bar counter and you’d need to approach the problem somewhat differently.
A simple BarsSince() function based on the start of each of each day is an alternative that I’ve already mentioned. Here’s how you might use it.
D:=DayOfWeek();
BC:=BarsSince(D<>Ref(D,-1))+1;
BC>=OPTx AND Cross(C,Mov(C,OPTx,S));
Roy
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 10/28/2004(UTC) Posts: 3,111 Location: Perth, Western Australia
Was thanked: 16 time(s) in 16 post(s)
|
mstt wrote:One issue you’d need to watch out for (I’m not sure if it’s relevant because I don’t have a real-time feed) is bars that are missed, deleted or just not present when no trades occur during any given minute.y You can count the bars so far in this trading session and pass this value to the Forum.Mov to alleviate issues with missing bars. wabbit [:D]
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.