My EA basically states, if Total Open Orders <= 1, buy/sell conditions. What I want now is for the EA to see that if it creates a buy order, it can still allow a sell order to be made but NOT another buy order. My EA states that up to 2 orders can be open at one time, but I want it to only allow the second order to be of the opposite type of what's currently open.
Adding this is going to assist with my drawdown issue, I'm just not sure how to code it up.
if( TotalOrdersCount()<=0)
Your posted code says zero not one- EA builder has been discussed before. It generates terrible code. Do a search.
- Like: Not checking return codes
- Like: Not adjusting for 4/5 digit brokers (slippage)
- Like: using Bars (max bars on chart) instead of time, and using ">" instead of "!=".
- Of course you don't know how to code it, because you used EAB. Why aren't you asking on their forum?
- Since there are no slaves here, you have only three choices: Search for it, learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt and the nature of your problem.
- Hedging is not allowed in the US
- Hedging is not going to help with your drawdown issue, it will double it, imo.
- Instead of counting the total open orders, count each type.
Hey guys,
My EA basically states, if Total Open Orders <= 1, buy/sell conditions. What I want now is for the EA to see that if it creates a buy order, it can still allow a sell order to be made but NOT another buy order. My EA states that up to 2 orders can be open at one time, but I want it to only allow the second order to be of the opposite type of what's currently open.
Adding this is going to assist with my drawdown issue, I'm just not sure how to code it up. I'll attach my EA. Not looking for criticisms about my decision to use ForexEAdvisor, just looking to add the above part. Thanks a lot guys.
LOL yikes.
Let me ask it another way. What would the logic look like if I wanted to achieve my above inquiry? I can do the coding/research myself once I know how it should look. Sorry for the code saying 0. I had made a change after I quoted the code.
I do want to get better at coding, hence why I'm asking on the forum. I don't want to pay someone else to do it for me if it's something I can do myself, however I am stuck and am requesting help. I have done a search for what I'm looking to do and I have been unsuccessful finding an example. If you know how to help me I would appreciate the expertise. The reason why I am using ForexEAdvisor is because it's basic enough for me to grasp the concepts of coding. I don't need the advanced features outlined by WHRoeder because quite frankly I have never found a need for any of those. Also, I'm not living in America so your comments on hedging in that context do not apply to me. Forgive my ignorance in assuming a forum is used to ask a question.
I'd appreciate any specific help you can offer me because I have posted my question here as my last attempt to figure it out. If anyone knows how to help me out, or has a better idea, I'm all ears. Thanks again,
- Checking error return code - don't need those. Don't come back here and ask why it's not working!
- Not learning the language - don't need that to add more code. This forum is about coding mq4 - go to the EA builder forum then.
- "What would the logic look like" - asked and answered: "instead of counting the total open orders, count each type." You already have code that counts total open orders. If you can't code the difference, then there is no common language for us to communicate with.
- If you don't want to learn to code in mq4 - stop wasting our time asking such simple questions and hire someone.
- Since there are no slaves here, you have only three choices: Search for it, learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt and the nature of your problem.
LOL yikes.
Let me ask it another way. What would the logic look like if I wanted to achieve my above inquiry? I can do the coding/research myself once I know how it should look. Sorry for the code saying 0. I had made a change after I quoted the code.
Which ticket is this code applicable to ? what are the units of OrderProfit() ? what are the units of TakeProfit ? will this code close an OP_BUY ?
if(OrderProfit()>=TakeProfit)
{
OrderClose(OrderTicket(),Lots,Ask,Slippage);
}
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hey guys,
My EA basically states, if Total Open Orders <= 1, buy/sell conditions. What I want now is for the EA to see that if it creates a buy order, it can still allow a sell order to be made but NOT another buy order. My EA states that up to 2 orders can be open at one time, but I want it to only allow the second order to be of the opposite type of what's currently open.
Adding this is going to assist with my drawdown issue, I'm just not sure how to code it up. I'll attach my EA. Not looking for criticisms about my decision to use ForexEAdvisor, just looking to add the above part. Thanks a lot guys.