Discussions
»
Product and Service Development
»
Formula Assistance
»
Need help to convert sell condition into Metastock Code
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 10/29/2004(UTC) Posts: 32
|
Hi,
Buy condition: cross(stoch(14,1),20)
Sell condtion: cross(80,stoch(14,1)) or When close cross the 90% of Buy price or the
90% price when Last buy signal generated.
I want your help to convert this conditon (When close cross the 90% of Buy price or the
90% price when Last buy signal generated ) into metastock code.
Regards,
(moneypick)
|
|
|
|
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)
|
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 10/29/2004(UTC) Posts: 32
|
Respected Wabbit,
Thanks for quick reply.
I create the metastock code for above condition with the help of your example:
------------------------------------------------------------------
N:=Cross(stoch(14,1),20);
X:=Cross(80,(Stoch(14,1));
StopLoss:=0.9; {percentage multiplier of the trade entry price}
Tr:=If(PREV=0,If(N,CLOSE, 0),If(X OR C<=PREV*StopLoss,0,PREV)); Tr;
---------------------------------------------------------------------------
Is it correct?
(moneypick)
|
|
|
|
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)
|
moneypick wrote:Code:
N:=Cross(stoch(14,1),20);
X:=Cross(150,(Stoch(14,1));
StopLoss:=0.9; {percentage multiplier of the trade entry price}
Tr:=If(PREV=0,If(N,CLOSE,0),If(X OR C<=PREV*StopLoss,0,PREV));
Tr;
Check your X condition, but the rest looks OK for what you are trying to achieve. Are the results as you expect?
I don't think having a fixed 10 percent below the entry price is going to do you any favours? I prefer some sort of trailing stop.
wabbit [:D]
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 10/29/2004(UTC) Posts: 32
|
Thanks Wabbit for your kind help.
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Discussions
»
Product and Service Development
»
Formula Assistance
»
Need help to convert sell condition into Metastock Code
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.