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

Notification

Icon
Error

Options
Go to last post Go to first unread
dieselpr  
#1 Posted : Monday, June 13, 2005 1:38:46 PM(UTC)
dieselpr

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 4/27/2005(UTC)
Posts: 130

Patrick, I am still having a difficult time understanding latchs in metastock. Any chance you might be offering training in this area? I just need to create some simple latchs so that the Buy and the buy exit signal don't come on the same bar. Same for the short Any info would be helpful
wabbit  
#2 Posted : Monday, June 13, 2005 1:56:23 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)
Have you had a look at Roy Larsen's excellent latches document already posted here: http://forum.equis.com/viewtopic.php?p=2487 If so, and you are still having trouble, what exactly are you having trouble with? Is it just simultaneous buys and sells? A simple way to stop events happening on the same day is to use the BarsSince() function. BE CAREFUL THOUGH. You can prevent an exit on the same day as the entry, which means the next day you will still be holding the stock despite the fact that your exit criteria has been tripped, or, you can prevent the entry on the same day as the exit. This has its own ramifications: if you normally enter the trade on open and you are using EOD then you are infact crystal-balling, knowing not to enter the stock first thing in the morning because the exit will be tripped later that day! The other side is the re-entry, you might exit the stock on open but your entry criteria is tripped later that same day - how do you want to handle this situation? If the BarsSince() isnt helping with what you need, break the code down into small pieces and plot each step as an indicator. Keep adding to the indicator until the code is right. If you have trouble, please post your code and we shall see what we can do as a group to help you out. Hope this helps. wabbit :D
dieselpr  
#3 Posted : Monday, June 13, 2005 5:20:49 PM(UTC)
dieselpr

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 4/27/2005(UTC)
Posts: 130

Thanks Wabbit, I have read that article and I'm still confused or maybe I'm having a hard time understanding what is it is I'm telling metastock to do. Problem- I want to control my entry -vs- exits, if i'm short one position and then the position goes against me or trends bullish I want metastock to simply 1.close the short first on one bar with an exit alert 2. on the very next bar open the long for entry I need to make sure the exit come before the rev. in position. I want to control the alerts timing not really the signals and the only way I can control the alerts timing it to delay it on the bars by making a latch. But my programing on latchs is weak. I'm working with an API system and it gets confused when the alerts hit on the same bar. I need send the exit before the entry. Got to love all this computer stuff its so smart its dum!
henry1224  
#4 Posted : Tuesday, June 14, 2005 12:12:18 AM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
Have a Look at the experts in the Metastock Formula collection. They show how to use the SysEval Function to create latches without having to use the Cum or Prev funtions
dieselpr  
#5 Posted : Tuesday, June 14, 2005 12:44:19 AM(UTC)
dieselpr

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 4/27/2005(UTC)
Posts: 130

henry1224, Can you please provide an example of a formule of a link there are ton of experts over there.
henry1224  
#6 Posted : Tuesday, June 14, 2005 12:54:40 AM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
All of the experts that I have created use the PowerPivots Plus Add-on to create latches, pick any of them
henry1224  
#7 Posted : Tuesday, June 14, 2005 1:27:11 AM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
wabbit  
#8 Posted : Tuesday, June 14, 2005 8:28:29 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)
dieselpr, If understand your problem correctly, you will always be in a trade, long or short? What you want then is a system that will transit out of long immediately into the short, from the short immediately into the long. The way to do this is to explicitly define the system for one of the criterial is true, either long or short. The FALSE criteria is then the other trade: N:=Fml("Long Trades")=1; X:=N=0; {not long trades} I:=Cum(N+X>-1)=1; Tr:=BarsSince(I OR N)<BarsSince(I OR X); Tr; Will return 1 for long trades and 0 for NOT long trades i.e short trades or N:=Fml("Short Trades")=1; X:=N=0; {not short trades} I:=Cum(N+X>-1)=1; Tr:=BarsSince(I OR N)<BarsSince(I OR X); Tr; To delay each entry and exit just Ref() back one day for each entry and exit, or use BarsSince(). Personally I would keep it as it is and set the delays in the system tester. If this doesnt help, then please post your code and we will see what we can do. [color=red:559bdc54a9]WARNING:[/color]This type of trading system has some massive drawbacks and I suggest that if you dont have your two criteria individually coded then you are leaving yourself open for some massive losses. Consider how much commission you will be paying for each trade swinging from long to short! You will need massive capital to offset the costs of trading, and the person making the most money will be your broker! Consider having a long entry and long exit independent of a short entry and short exit system. It [color=blue:559bdc54a9]WILL[/color] save you in the long run. wabbit :D
dieselpr  
#9 Posted : Tuesday, June 14, 2005 5:11:48 PM(UTC)
dieselpr

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 4/27/2005(UTC)
Posts: 130

Thanks for the information wabbit but no I don't want a system that is alway in a trade. The system is straight forward once the condition are met. I just need to develop a simple latch that will alway exit before it opens a new position. example: Say I got a buy from the MACD to enter long ok. Then 10 bars later I get an exit single followed by a short single from the macd. I want the short single delayed one bar so that the exit always come before the short or buy enter. The system isn't going to alway be in a trade its not a swing system is a simple support and resistence system. I'm just tring to prevent a condition that i'm getting with alerts alot.
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.