EURUSD Negative Breakout v0.1

Profit factor:
0.31
Orders Execution
Checks for the total of open ordersIt Closes Orders by itself It automatically opens orders when conditions are reached
Indicators Used
Moving average indicator
0 Views
0 Downloads
0 Favorites
EURUSD Negative Breakout v0.1
//+-----------------------------------------------------------+
//|                               EURUSD Negative Breakout EA |
//|                                               version 0.1 |
//|                               Original idea from mushy999 |
//|                                    EA conversion by Azmel |
//|                                 Copyright © Forex-TSD.com |
//+-----------------------------------------------------------+
//| INSTRUCTIONS: Attach the EA to EURUSD M5 chart.           |
//+-----------------------------------------------------------+
//| VERSION HISTORY                                           |
//| 0.1   - Initial release.                                  |
//+-----------------------------------------------------------+
#include <stdlib.mqh>

//EXTERNAL VARIABLES
extern int    Magic=327697;
extern double Lots=0.01;
extern int    TakeProfit=80;
extern int    StopLoss=1000;
extern int    HighCount=65;
extern int    FirstMAP=50;
extern int    SecondMAP=166;
extern int    FirstMAType0to4=2;
extern int    SecondMAType0to4=2;
extern int    FirstPriceType0to6=3;
extern int    SecondPriceType0to6=0;
extern int    PeriodsTillClose=310000;

int    counter;
int    counter2=0;
double Low100;
double High100;
int    i;
int    slippage=5;
int    ticket;
double FirstMA;
double SecondMA;
double Price[2];

int start()
{
   int iOrders=OrdersTotal()-1;
   counter2++;
   FirstMA=iMA(Symbol(),0,FirstMAP,1,FirstMAType0to4,FirstPriceType0to6,1);
   SecondMA=iMA(Symbol(),0,SecondMAP,1,SecondMAType0to4,SecondPriceType0to6,1);

   if(counter2 > PeriodsTillClose)
   {
     for(i=iOrders; i>=0; i--) 
     {
       if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES) && (OrderType()<=OP_SELL) && GetMarketInfo() && !OrderClose(OrderTicket(),OrderLots(),Price[1-OrderType()],slippage)) Print(OrderError());
     }
     counter2=0;
   }
   
   
   High100=0;
   for(i=1;i<=HighCount;i++)
   {
      High100=MathMax(High100,High[i]);
   }
   
   if(Ask>High100+1*Point && CountTrades()<=20 && DayOfWeek()!=5 && FirstMA < SecondMA)
   {
      Lots=AccountBalance() / 400000;
      counter2=0;
      ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,slippage,Ask-StopLoss*Point,Ask+TakeProfit*Point,"GBPUSD Breakout",Magic,0,Blue);
   }

   return(0);
}

int CountTrades()
{
   counter=0;
   for(i=0;i<OrdersTotal();i++)
   {
      OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
      if(OrderMagicNumber()==Magic)
      {
         counter++;
      }
   }
   return(counter);
}


//+------------------------------------------------------------------+
//| Function..: OrderError                                           |
//+------------------------------------------------------------------+
string OrderError() {
  int iError=GetLastError();
  return(StringConcatenate("Order:",OrderTicket()," GetLastError()=",iError," ",ErrorDescription(iError)));
}
 

//+------------------------------------------------------------------+
//| Function..: GetMarketInfo                                        |
//| Returns...: bool Success.                                        |
//+------------------------------------------------------------------+
bool GetMarketInfo() {
  RefreshRates();
  Price[0]=MarketInfo(OrderSymbol(),MODE_ASK);
  Price[1]=MarketInfo(OrderSymbol(),MODE_BID);
  double dPoint=MarketInfo(OrderSymbol(),MODE_POINT);
  if(dPoint==0) return(false);
  //giSlippage=(Price[0]-Price[1])/dPoint;
  return(Price[0]>0.0 && Price[1]>0.0);
}

Profitability Reports

USD/CAD Oct 2024 - Jan 2025
0.00
Total Trades 0
Won Trades 0
Lost trades 0
Win Rate 0.0 %
Expected payoff 0.00
Gross Profit 0.00
Gross Loss 0.00
Total Net Profit 0.00
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
0.38
Total Trades 837
Won Trades 690
Lost trades 147
Win Rate 82.44 %
Expected payoff -2.16
Gross Profit 1104.00
Gross Loss -2912.94
Total Net Profit -1808.94
-100%
-50%
0%
50%
100%
AUD/USD Oct 2024 - Jan 2025
0.24
Total Trades 567
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -3.59
Gross Profit 638.40
Gross Loss -2673.02
Total Net Profit -2034.62
-100%
-50%
0%
50%
100%

Comments