logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
oem7110  
#1 Posted : Sunday, April 11, 2010 6:57:32 AM(UTC)
oem7110

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
wabbit  
#2 Posted : Sunday, April 11, 2010 7:41:23 AM(UTC)
wabbit

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]

oem7110  
#3 Posted : Sunday, April 11, 2010 3:46:18 PM(UTC)
oem7110

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
wabbit  
#4 Posted : Sunday, April 11, 2010 7:04:04 PM(UTC)
wabbit

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.