Multiple entry conditions

 

Hi, can anyone advise me on how to create a robot with multiple entry conditions and all of them can only have a single trade. For example, I have 2 strategies:

1. RSI strategy

2. MA crossover strategy

If RSI < 30 I'll enter a trade and when 20MA cross above or below 50MA I'll also enter another trade. However, both of the conditions are independent and for different trades. It's not like

if(RSI < 30 && FastMA0 > SlowMA0 && SlowMA1>FastMA1)

Since it's not "AND".


Moreover, for both of the strategies, I only want them to have a single trade. I know you can use Magic number to identify the EA and OrderTotal to see the total trades. However, what if it's the same expert advisor with different strategies?


My apology for poor explanations and I hope to hear from you soon whether is this feasible or not? Thank you and have a nice day.

 
Xcellencetechnology:

if(RSI < 30 && FastMA0 > SlowMA0 && SlowMA1>FastMA1)


if(RSI < 30) // enter trade with magix X
if(FastMA0 > SlowMA0 && SlowMA1>FastMA1)  // enter trade with magix Y
 
Xcellencetechnology:

Moreover, for both of the strategies, I only want them to have a single trade. 

You can count trades with specific magic number to check if the strategy has already opened a position:

int countX(int magic)
{
        int counter=0;
        for(int i=0;i<OrdersTotal();i++)
        {
                if(OrderSelect(i, SELECT_BY_POS))
                {
                        if(OrderType()>1) continue;
                        if(OrderMagicNumber()==magic) counter++;
                }
        }
        return counter;
}
 
Xcellencetechnology: can anyone advise me on how to create a robot

You have only four choices:

  1. Search for it (CodeBase or Market). Do you expect us to do your research for you?

  2. Try asking at:

  3. MT4: Learn to code it.
    MT5: Begin learning to code it.

    If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into your code.

  4. Or pay (Freelance) someone to code it. Top of every page is the link Freelance.
              Hiring to write script - General - MQL5 programming forum (2019)

We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using CODE button) and state the nature of your problem.
          No free help (2017)

Reason: