Error

 Previous Topic Next Topic
 kerrydianne #1 Posted : Tuesday, April 7, 2020 3:35:44 AM(UTC) Rank: NewbieGroups: Registered, Registered Users, SubscribersJoined: 2/7/2019(UTC)Posts: 4Location: Gold CoastThanks: 1 times HiI 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. ThanksKerry
 Wanna join the discussion?! Login to your Discussions forum accountor Register a new forum account.
 MS Support #2 Posted : Tuesday, April 7, 2020 7:57:57 PM(UTC) Rank: Advanced MemberGroups: Moderators, Registered, Registered Users, SubscribersJoined: 10/8/2010(UTC)Posts: 1,621Thanks: 51 timesWas thanked: 130 time(s) in 126 post(s) Originally Posted by: kerrydianne HiI 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. ThanksKerry 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) Rank: NewbieGroups: Registered, Registered Users, SubscribersJoined: 2/7/2019(UTC)Posts: 4Location: Gold CoastThanks: 1 times Wow, thanks so much for this! Kerry
 MS Support #4 Posted : Wednesday, April 8, 2020 11:24:47 PM(UTC) Rank: Advanced MemberGroups: Moderators, Registered, Registered Users, SubscribersJoined: 10/8/2010(UTC)Posts: 1,621Thanks: 51 timesWas thanked: 130 time(s) in 126 post(s) Originally Posted by: kerrydianne 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
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.