If last trade was BUY, next trade should be SELL

 
Hello! 
Am working on an EA and I wanted to alternate orders. I have failed to make it possible. I want to check if previous trade was BUY the next trade should be it's opposite and vise versa.
Help will be much appreciated folks
 
Worldwide Fox: I want to check

So what's stopping you?

Help you with what? You haven't stated a problem, you stated a want. Show us your attempt (using the CODE button) and state the nature of your problem.
          No free help (2017)

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

We're not going to code it for you (although it could happen if you are lucky or the problem is interesting).
          No free help (2017)

 
Worldwide Fox:
Hello! 
Am working on an EA and I wanted to alternate orders. I have failed to make it possible. I want to check if previous trade was BUY the next trade should be it's opposite and vise versa.
Help will be much appreciated folks

You can start learning to code using this link:

https://www.mql5.com/en/forum/296230

if(prev_position_type==POSITION_TYPE_BUY)
   {m_trade.Sell(Lot,m_symbol.Name(),Bid,0,0,NULL);  
    return;               
        }

if(prev_position_type==POSITION_TYPE_SELL)
   {m_trade.Buy(Lot,m_symbol.Name(),Ask,0,0,NULL);  
    return;               
        }
How to start with MQL5
How to start with MQL5
  • 2018.12.24
  • www.mql5.com
This thread discusses MQL5 code examples. There will be examples of how to get data from indicators, how to program advisors...