Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 12/30/2005(UTC) Posts: 120
|
Does anyone have any suggestions on how to code it in Metastock?
Holding position is given as HP, which return TRUE or FALSE for status.
A buy signal is given as BS, which return TRUE or FALSE for status.
A sell signal is given as SS, which return TRUE or FALSE for status.
If I hold no position, then I would like ignore any buy or sell signal
before 10:15 am and after 12:15 pm before the lunch time (12:30pm) and before
2:45 pm and after 3:45 pm before the
closing time (4:00 pm).
If I hold position, then I would like to exit any buy or sell position at 12:25
pm before the lunch time (12:30pm) and at 3:55 pm before the closing time (4:00
pm).
Does anyone have any suggestions on how to code it in Metastock?
Thanks in advance for any suggestions
Eric
|
|
|
|
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)
|
The easiest way (IMHO) to deal with time in MS is to convert everything to the same number base; I use minutes of the day. You can define your session start times and end times easily using this number base and do the same for the time of each bar. This makes it easy to compare the bar time with the session start and end times. If you're in a trading session then keep the trading signals otherwise set them to zero. Do the same process for the exit timings, then use either a PREV based latch or another latching system to signal the trades.
wabbit [:D]
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 12/30/2005(UTC) Posts: 120
|
Could you please show me how to convert everything to the same number base?
Thank you very much for any suggestions
Eric
|
|
|
|
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)
|
Code:
sessionStart := (10 * 60) + 15; {10:15 am}
sessionEnd := (15 * 60) + 30; {15:30 pm}
barTime := (Hour() * 60) + Minute();
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.