Close & Reverse

To add comments, please log in or register
zunifx79
68
zunifx79  
Hi Guys is there a close and reverse script out there where it allows to close my trade and automatically open a trade in the opposite direction with the same lot size I closed with? Thanks
Greg Pawlak
195
Greg Pawlak  
Hi, have you checked the CodeBase section on the top of the page?. Greetings, Greg
zunifx79
68
zunifx79  
No I haven't I'll take a look Thanks
Husain Dana
474
Husain Dana  
zunifx79:
Hi Guys is there a close and reverse script out there where it allows to close my trade and automatically open a trade in the opposite direction with the same lot size I closed with?


Look for SAR or Parabolic EA. This should work for reversal
Greg Pawlak
195
Greg Pawlak  
if you don't find EA, create new order in freelance section, this is not complicated code so it won't be too expensive. Regards Greg
Busingye Tusasirwe
139
Busingye Tusasirwe  
zunifx79:
Hi Guys is there a close and reverse script out there where it allows to close my trade and automatically open a trade in the opposite direction with the same lot size I closed with? Thanks

This should work.

<ex4 file deleted>

Busingye Tusasirwe
139
Busingye Tusasirwe  
//+------------------------------------------------------------------+
//|                                        AAA_Close and Reverse.mq4 |
//|                                               Tusasirwe Busingye |
//|                                            Telegram:             |
//+------------------------------------------------------------------+
#property copyright "Tusasirwe Busingye"
#property link      "
    busingye"
#property version   "1.00"
#property strict

extern int Slippage=5;

int r=0;
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   for(int i=OrdersTotal()-1; i>=0; i--)
     {
      if(OrderSelect(OrdersTotal()-1, SELECT_BY_POS, MODE_TRADES)==True)
        {
         if(OrderType()==OP_BUY && r!=10209)
           {
            bool buy=OrderClose(OrderTicket(),OrderLots(),Bid,Slippage,clrBlue);
            int b=OrderSend(OrderSymbol(),OP_SELL,OrderLots(),Bid,Slippage,0,0,NULL,0,0,clrRed);
            r=10209;
           }
         if(OrderType()==OP_SELL && r!=10209)
           {
            bool sell=OrderClose(OrderTicket(),OrderLots(),Ask,Slippage,clrRed);
            int s=OrderSend(OrderSymbol(),OP_BUY,OrderLots(),Ask,Slippage,0,0,NULL,0,0,clrBlue);
            r=10209;
           }
        }
     }
  }
//+------------------------------------------------------------------+
<ex4 file deleted>

To add comments, please log in or register