EURGBP H1 RULE BASED

Author: Expert Advisor Builder
Profit factor:
0.40
Orders Execution
Checks for the total of open ordersIt Closes Orders by itself It can change open orders parameters, due to possible stepping strategyIt automatically opens orders when conditions are reached
Indicators Used
Ichimoku Kinko HyoIndicator of the average true range
Miscellaneous
It sends emails
10 Views
0 Downloads
0 Favorites
EURGBP H1 RULE BASED


#define SIGNAL_NONE 0
#define SIGNAL_BUY   1
#define SIGNAL_SELL  2
#define SIGNAL_CLOSEBUY 3
#define SIGNAL_CLOSESELL 4

#property copyright "Expert Advisor Builder"
#property link      "http://"

extern int MagicNumber = 0;
extern bool SignalMail = False;
extern bool EachTickMode = False;
extern double Lots = 1.0;
extern int Slippage = 3;
extern bool UseStopLoss = True;
extern int StopLoss = 200;
extern bool UseTakeProfit = True;
extern int TakeProfit = 80;
extern bool UseTrailingStop = True;
extern int TrailingStop = 30;

int BarCount;
int Current;
bool TickCheck = False;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init() {
   BarCount = Bars;

   if (EachTickMode) Current = 0; else Current = 1;

   return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit() {
   return(0);
}
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start() {
   int Order = SIGNAL_NONE;
   int Total, Ticket;
   double StopLossLevel, TakeProfitLevel;



   if (EachTickMode && Bars != BarCount) TickCheck = False;
   Total = OrdersTotal();
   Order = SIGNAL_NONE;

   //+------------------------------------------------------------------+
   //| Variable Begin                                                   |
   //+------------------------------------------------------------------+


double Buy1_1 = iIchimoku(NULL, 0, 9, 26, 52, MODE_TENKANSEN, Current + 0);
double Buy1_2 = 0.791325;
double Buy2_1 = iATR(NULL, 0, 12, Current + 0);
double Buy2_2 = 0.001812;

double Sell1_1 = iIchimoku(NULL, 0, 9, 26, 52, MODE_TENKANSEN, Current + 0);
double Sell1_2 = 0.791325;
double Sell2_1 = iATR(NULL, 0, 12, Current + 0);
double Sell2_2 = 0.001812;



   
   //+------------------------------------------------------------------+
   //| Variable End                                                     |
   //+------------------------------------------------------------------+

   //Check position
   bool IsTrade = False;

   for (int i = 0; i < Total; i ++) {
      OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
      if(OrderType() <= OP_SELL &&  OrderSymbol() == Symbol()) {
         IsTrade = True;
         if(OrderType() == OP_BUY) {
            //Close

            //+------------------------------------------------------------------+
            //| Signal Begin(Exit Buy)                                           |
            //+------------------------------------------------------------------+

            

            //+------------------------------------------------------------------+
            //| Signal End(Exit Buy)                                             |
            //+------------------------------------------------------------------+

            if (Order == SIGNAL_CLOSEBUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
               OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, MediumSeaGreen);
               if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + " Close Buy");
               if (!EachTickMode) BarCount = Bars;
               IsTrade = False;
               continue;
            }
            //Trailing stop
            if(UseTrailingStop && TrailingStop > 0) {                 
               if(Bid - OrderOpenPrice() > Point * TrailingStop) {
                  if(OrderStopLoss() < Bid - Point * TrailingStop) {
                     OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * TrailingStop, OrderTakeProfit(), 0, MediumSeaGreen);
                     if (!EachTickMode) BarCount = Bars;
                     continue;
                  }
               }
            }
         } else {
            //Close

            //+------------------------------------------------------------------+
            //| Signal Begin(Exit Sell)                                          |
            //+------------------------------------------------------------------+

            

            //+------------------------------------------------------------------+
            //| Signal End(Exit Sell)                                            |
            //+------------------------------------------------------------------+

            if (Order == SIGNAL_CLOSESELL && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
               OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, DarkOrange);
               if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + " Close Sell");
               if (!EachTickMode) BarCount = Bars;
               IsTrade = False;
               continue;
            }
            //Trailing stop
            if(UseTrailingStop && TrailingStop > 0) {                 
               if((OrderOpenPrice() - Ask) > (Point * TrailingStop)) {
                  if((OrderStopLoss() > (Ask + Point * TrailingStop)) || (OrderStopLoss() == 0)) {
                     OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * TrailingStop, OrderTakeProfit(), 0, DarkOrange);
                     if (!EachTickMode) BarCount = Bars;
                     continue;
                  }
               }
            }
         }
      }
   }

   //+------------------------------------------------------------------+
   //| Signal Begin(Entry)                                              |
   //+------------------------------------------------------------------+

   if (Buy1_1 <= Buy1_2 && Buy2_1 <= Buy2_2) Order = SIGNAL_BUY;

   if (Sell1_1 > Sell1_2 || Sell2_1 > Sell2_2) Order = SIGNAL_SELL;


   //+------------------------------------------------------------------+
   //| Signal End                                                       |
   //+------------------------------------------------------------------+

   //Buy
   if (Order == SIGNAL_BUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
      if(!IsTrade) {
         //Check free margin
         if (AccountFreeMargin() < (1000 * Lots)) {
            Print("We have no money. Free Margin = ", AccountFreeMargin());
            return(0);
         }

         if (UseStopLoss) StopLossLevel = Ask - StopLoss * Point; else StopLossLevel = 0.0;
         if (UseTakeProfit) TakeProfitLevel = Ask + TakeProfit * Point; else TakeProfitLevel = 0.0;

         Ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage, StopLossLevel, TakeProfitLevel, "Buy(#" + MagicNumber + ")", MagicNumber, 0, DodgerBlue);
         if(Ticket > 0) {
            if (OrderSelect(Ticket, SELECT_BY_TICKET, MODE_TRADES)) {
				Print("BUY order opened : ", OrderOpenPrice());
                if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + " Open Buy");
			} else {
				Print("Error opening BUY order : ", GetLastError());
			}
         }
         if (EachTickMode) TickCheck = True;
         if (!EachTickMode) BarCount = Bars;
         return(0);
      }
   }

   //Sell
   if (Order == SIGNAL_SELL && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
      if(!IsTrade) {
         //Check free margin
         if (AccountFreeMargin() < (1000 * Lots)) {
            Print("We have no money. Free Margin = ", AccountFreeMargin());
            return(0);
         }

         if (UseStopLoss) StopLossLevel = Bid + StopLoss * Point; else StopLossLevel = 0.0;
         if (UseTakeProfit) TakeProfitLevel = Bid - TakeProfit * Point; else TakeProfitLevel = 0.0;

         Ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, Slippage, StopLossLevel, TakeProfitLevel, "Sell(#" + MagicNumber + ")", MagicNumber, 0, DeepPink);
         if(Ticket > 0) {
            if (OrderSelect(Ticket, SELECT_BY_TICKET, MODE_TRADES)) {
				Print("SELL order opened : ", OrderOpenPrice());
                if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + " Open Sell");
			} else {
				Print("Error opening SELL order : ", GetLastError());
			}
         }
         if (EachTickMode) TickCheck = True;
         if (!EachTickMode) BarCount = Bars;
         return(0);
      }
   }

   if (!EachTickMode) BarCount = Bars;

   return(0);
}
//+------------------------------------------------------------------+

Profitability Reports

NZD/USD Jul 2025 - Sep 2025
0.59
Total Trades 465
Won Trades 362
Lost trades 103
Win Rate 77.85 %
Expected payoff -17.96
Gross Profit 12123.00
Gross Loss -20475.00
Total Net Profit -8352.00
-100%
-50%
0%
50%
100%
GBP/USD Jul 2025 - Sep 2025
0.06
Total Trades 62
Won Trades 14
Lost trades 48
Win Rate 22.58 %
Expected payoff -145.18
Gross Profit 599.00
Gross Loss -9600.00
Total Net Profit -9001.00
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
0.08
Total Trades 92
Won Trades 23
Lost trades 69
Win Rate 25.00 %
Expected payoff -98.92
Gross Profit 753.36
Gross Loss -9854.31
Total Net Profit -9100.95
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
0.42
Total Trades 369
Won Trades 249
Lost trades 120
Win Rate 67.48 %
Expected payoff -24.51
Gross Profit 6546.43
Gross Loss -15591.38
Total Net Profit -9044.95
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
0.24
Total Trades 137
Won Trades 77
Lost trades 60
Win Rate 56.20 %
Expected payoff -66.77
Gross Profit 2853.00
Gross Loss -12000.00
Total Net Profit -9147.00
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.76
Total Trades 482
Won Trades 387
Lost trades 95
Win Rate 80.29 %
Expected payoff -9.44
Gross Profit 14314.00
Gross Loss -18863.00
Total Net Profit -4549.00
-100%
-50%
0%
50%
100%
USD/CAD Oct 2024 - Jan 2025
0.51
Total Trades 551
Won Trades 422
Lost trades 129
Win Rate 76.59 %
Expected payoff -16.40
Gross Profit 9467.44
Gross Loss -18505.07
Total Net Profit -9037.63
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
0.35
Total Trades 207
Won Trades 137
Lost trades 70
Win Rate 66.18 %
Expected payoff -44.25
Gross Profit 4841.00
Gross Loss -14000.00
Total Net Profit -9159.00
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
0.81
Total Trades 922
Won Trades 753
Lost trades 169
Win Rate 81.67 %
Expected payoff -6.99
Gross Profit 27359.00
Gross Loss -33800.00
Total Net Profit -6441.00
-100%
-50%
0%
50%
100%
AUD/USD Oct 2024 - Jan 2025
0.39
Total Trades 254
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -35.78
Gross Profit 5713.00
Gross Loss -14800.00
Total Net Profit -9087.00
-100%
-50%
0%
50%
100%

Comments