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

Notification

Icon
Error

Options
Go to last post Go to first unread
kerrydianne  
#1 Posted : Tuesday, April 7, 2020 3:35:44 AM(UTC)
kerrydianne

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 2/7/2019(UTC)
Posts: 4
Location: Gold Coast

Thanks: 1 times

Hi

I am trying to design a template to go with an Explorer/system that I have set up.

How do I get my Expert Advisor to show only the first buy and sell signals??  That is, assume I only want one trade open at a time.  So a 2nd buy or sell signal should not show until the first trade has closed.

Thanks

Kerry

MS Support  
#2 Posted : Tuesday, April 7, 2020 7:57:57 PM(UTC)
MS Support

Rank: Advanced Member

Groups: Moderators, Registered, Registered Users, Subscribers
Joined: 10/8/2010(UTC)
Posts: 1,960

Thanks: 92 times
Was thanked: 155 time(s) in 150 post(s)
Originally Posted by: kerrydianne Go to Quoted Post

Hi

I am trying to design a template to go with an Explorer/system that I have set up.

How do I get my Expert Advisor to show only the first buy and sell signals??  That is, assume I only want one trade open at a time.  So a 2nd buy or sell signal should not show until the first trade has closed.

Thanks

Kerry

Hi,

There are a few ways you can limit conditions depending on the complexity and number of conditions. Here is one example using some moving average criteria:

Code:
bc:=C > Mov(C,20,S)+1{enter long condition};
be:=Cross(Mov(C,20,S),C){close long condition};
sc:=C < Mov(C,20,S)-1{enter short condition};
se:=Cross(C,Mov(C,20,S)){close short condition};
If( bc=1, 1, If(sc=1, -1, If(be OR se,0,PREV)))

One that uses a simple Buy/Sell criteria could be written as:

Code:
bc:=Cross(C,Mov(C,20,S)){buy signal condition};
sc:=Cross(Mov(C,20,S),C){sell signal condition};
trade:=If( bc=1, 1, If(sc=1, 0, PREV));
cross( trade= x, 0.5)

You will need to change the Trade=X, in the above formula to Trade= 1, or Trade= 0, depending on the condition you are defining, so basically you would use that formula once for your limited "Buy" signal and once for your limited "Sell" signal, the only difference between the 2 formulas being the value of X.

If these do not meet your criteria you may wish to request custom formula work at https://www.metastock.com/customer/resources/Formulas/CustomFormulaForm.aspx although there is a charge for this.

Edited by user Wednesday, April 8, 2020 11:26:45 PM(UTC)  | Reason: Not specified

kerrydianne  
#3 Posted : Tuesday, April 7, 2020 10:54:55 PM(UTC)
kerrydianne

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 2/7/2019(UTC)
Posts: 4
Location: Gold Coast

Thanks: 1 times

Wow, thanks so much for this!

Kerry

MS Support  
#4 Posted : Wednesday, April 8, 2020 11:24:47 PM(UTC)
MS Support

Rank: Advanced Member

Groups: Moderators, Registered, Registered Users, Subscribers
Joined: 10/8/2010(UTC)
Posts: 1,960

Thanks: 92 times
Was thanked: 155 time(s) in 150 post(s)
Originally Posted by: kerrydianne Go to Quoted Post

Wow, thanks so much for this!

Kerry

Happy to help! I realized I left off the explanation of "X" in one of the formulas and edited the original reply for clarification.

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.