How to place Buy and Sell orders at the same time



I need help placing a buy order and a sell order at the high and low of a candle, the EA already recognizes the candle pattern i want, but i dont know how to place the orders. 

I really need help.

This is what i have so far

#include <Trade\Trade.mqh>

CTrade trade;

MqlRates rates[];

int OnInit()

     ArraySetAsSeries(rates, true);
     return (INIT_SUCCEEDED);

void OnTick()

    CopyRates(Symbol(), Period (), 0, 3, rates);
    double maxCurrent = rates[1].high;
    double minCurrent = rates[1].low;
    double maxPrev = rates[2].high;
    double minPrev = rates[2].low;
    double openCurrent = rates[1].open;
    double closeCurrent = rates[1].close;
    if(maxPrev > maxCurrent && minPrev < minCurrent) 
    if(OrdersTotal()==0 && PositionsTotal()==0){

It sounds like that you want to place limit orders? A limit buy and/or limit sell order?

You can find more information about these on this page:

Documentation on MQL5: Standard Library / Trade Classes / CTrade
Documentation on MQL5: Standard Library / Trade Classes / CTrade
Standard Library / Trade Classes / CTrade - Reference on algorithmic/automated trading language for MetaTrader 5
William Roeder  
Leonardo Fernandez: I need help … i want, … but i dont know how … need help.
Help you with what? You haven't stated a problem, you stated a want. You have only four choices:
  1. Search for it.

  2. Beg 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 yours.

  4. or pay (Freelance) someone to code it.
              Hiring to write script - General - MQL5 programming forum

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