Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 10/29/2004(UTC) Posts: 32
|
Respected Members,
I want to convert following two condition in metastock code:
1. Buy above the Buy Signals High only or Sell Below the Sell Signals Low only.
2. Break above the High in case of Buy signal & vice versa
should within 2 trading sessions.
Buy and Sell formula :
Buy when Cross(Fml("MA1"),Fml("MA2"))
Sell when Cross(Fml("MA2"),Fml("MA1"))
Please guide me,
Thx,
(moneypick)
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Unverified Users Joined: 9/13/2004(UTC) Posts: 673 Location: Salt Lake City, UT
|
I don't understand your second condition. I believe your first condition can be written as follows:
Buy
X:=ValueWhen(1,Cross(Fml("MA1"),Fml("MA2")),H);
C>X
Sell
X:=ValueWhen(1,Cross(Fml("MA2"),Fml("MA1")),L);
C<X
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 4/27/2005(UTC) Posts: 31
|
If I understand your conditions, you want to buy above the high of the day the cross occured, if it occurs within 2 bars of the cross. This would be written as:
cross(H,ValueWhen(1,Cross(Fml("MA1"),Fml("MA2")),H)) AND alert(Cross(Fml("MA1"),Fml("MA2")), 3 )
I used 3 in the alert so the cross can have occured on either of the two bars before this bar
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 10/29/2004(UTC) Posts: 32
|
|
|
|
|
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.