EA that does not keep making the same order

 
Can someone help me make the EA i created stop making concecutive orders of the same type ...  i mean a code that tells it that if the previous signal was sell... it should not trigger another sell.... but do a buy...so it goes sell ...buy sell buy..... not buy buy buy ..
Help .
 

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.04.21)

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

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.04.21)

 
Jason Tanaka Mabika:
Can someone help me make the EA i created stop making concecutive orders of the same type ...  i mean a code that tells it that if the previous signal was sell... it should not trigger another sell.... but do a buy...so it goes sell ...buy sell buy..... not buy buy buy ..
Help .

You should check previous order, if that is buy, then this order is not buy, open sell only, and vice versa.

For example code:

int order_type_pre = -1;
bool ticket = OrderSelect(OrdersTotal()-1, SELECT_BY_POS, MODE_TRADES);
if(OrderSymbol() == Symbol())
        {
                order_type_pre = OrderType();
        }
// Compare pre order type with this open order type
if(order_type_pre != OP_BUY) {
        // Open buy order
}
if(order_type_pre != OP_SELL) {
        // Open sell order
}
 
Jason Tanaka Mabika:
Thank yu nguyen van cho... I ddnt knw of the name type_order _pre
Ths shud do it
 
Nguyen Van Cho:

You should check previous order, if that is buy, then this order is not buy, open sell only, and vice versa.

For example code:

where can you learn more about code for writing and modifying EA's thanks
 
Jason Tanaka Mabika:
Can someone help me make the EA i created stop making concecutive orders of the same type ...  i mean a code that tells it that if the previous signal was sell... it should not trigger another sell.... but do a buy...so it goes sell ...buy sell buy..... not buy buy buy ..
Help .

Example: The EA can open only one position of the same type

How to start with MQL5
How to start with MQL5
  • 2021.06.15
  • www.mql5.com
This thread discusses MQL5 code examples. There will be examples of how to get data from indicators, how to program advisors...