Blessing 2 v3.3 update2

Download script
Author: Copyright � 2007-2008, FiFtHeLeMeNt.
Profit factor:
0.73

This automated trading script is designed to manage and execute trades by identifying market trends and employing a structured grid-based strategy. Below is a breakdown of the logic used by the system in non-technical terms:

Market Analysis & Trend Detection

The script first determines the general direction of the market to decide which types of trades are appropriate. It uses a Moving Average (MA) as its primary compass:

  • Uptrend: If the current price is above the moving average, the system focuses on "Long" positions (buying).
  • Downtrend: If the price is below the moving average, it focuses on "Short" positions (selling).
  • Range/Neutral: It can also recognize conditions where the market is moving sideways, allowing for specific behaviors in those environments.

Smart Trade Entry & Positioning

Instead of just opening a trade at the current price, the script uses "Pending Orders." These are essentially instructions to buy or sell only when the price reaches a specific level.

  • Rounding Logic: The system includes a small offset to ensure that its entries align with "round numbers" on the price chart, which can help in aligning with common psychological levels.
  • Buffer Zones: It respects the minimum distance required by the broker (Stop Levels) to ensure that orders are placed successfully and not rejected.

Dynamic Grid Management

The core of this script is a "Grid System." When the market moves against an open position, rather than closing it immediately, the script places additional orders at pre-defined intervals:

  • Multi-Level Scaling: The strategy has three distinct levels of grids. As more positions are opened, the distance between the trade levels and the profit targets increases automatically.
  • Volume Scaling: The script can increase the size (lots) of each subsequent trade in the grid to help recover losses faster from a moving market.
  • Time Filtering: To prevent opening too many trades during periods of extreme volatility, it uses a "Time Grid" timer. This ensures there is a minimum amount of time between adding new levels to the grid.

Safety & Risk Management

The script includes several layers of protection to safeguard the account:

  • Automatic Money Management: It can automatically calculate your trade size based on a specific percentage of your total account balance, ensuring that risk is consistent across different trades.
  • Take Profit Synchronization: The script ensures that all open positions in a series share a synchronized "Take Profit" target. This helps the system exit the entire group of trades as a single unit once the desired profit is reached.
  • Emergency Exit (BELevel): There is a maximum threshold for the number of levels the grid can reach. If the market moves too far in one direction and hits this limit, the system will close all positions automatically to prevent excessive losses.

Operational Intelligence

The script identifies itself using unique "Magic Numbers" for different currency pairs. This allows it to manage multiple different trades simultaneously without confusing a trade on one pair (e.g., EURUSD) with a trade on another (e.g., GBPJPY), ensuring each market environment is handled independently and accurately.

Orders Execution
Checks for the total of open ordersIt Closes Orders by itself It automatically opens orders when conditions are reachedIt can change open orders parameters, due to possible stepping strategy
Indicators Used
Moving average indicator
16 Views
0 Downloads
0 Favorites
Blessing 2 v3.3 update2
//+------------------------------------------------------------------+
//|                                                     Blessing 3.3 |
//|                              Copyright © 2007-2008, MQLCoder.com |
//|                                             support@mqlcoder.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007-2008, FiFtHeLeMeNt."
#property link      "http://www.mqlcoder.com"

extern bool UseMM             = 1;      // Money Management - 1 = true & 0 = false.
extern double Risk            = 3.2;    // Percent of account balance to risk per trade.
extern double lot             = 0.2;    // Starting lots if Money Management is off
extern bool Micro             = true;   // Does your account have the ability to trade micro lots
extern int MC                 = 2;      // Market condition 0=uptrend 1=downtrend 2=range
extern bool MCbyMA            = true;   // Defines market condition by EMA , if price is above EMA,
                                        // it will take it as an uptrend and goes only long , vice versa for below the EMA
extern int MA_Period          = 100;     // Period of EMA
extern double Multiplier      = 1.4;    // Multiplier on each level
extern double LotInc          = 0;      // Lot Increment on each level
extern int TimeGrid           = 2400;   // Time Grid in seconds , to avoid opening of lots of levels in fast market
extern int GridSet1           = 25;     // Set 1 Grid Size
extern int TP_Set1            = 50;     // Set 1 Take Profit
extern int GridSet2           = 50;     // Level 2 Grid Size
extern int TP_Set2            = 100;    // Level 2 Take Profit
extern int GridSet3           = 100;    // Level 3 Grid Size
extern int TP_Set3            = 200;    // Level 3 Take Profit
extern int d                  = 5;      // Used to offset entry to round numbers , for example if you set d=5,
                                        // it will place its sell order on 1.5795 instead of 1.5780
extern int Set1Count          = 4;      // Level 1 max levels
extern int Set2Count          = 4;      // Level 2 max levels
extern int MaxLevel           = 99;     // Level 2 max levels (stops placing orders when reaches maxlvl2)
extern int BELevel            = 99;     // Close All level , when reaches this level, doesn't wait for TP to be hit 


// Internal Parameters
bool ca                       = false;
string EA_name                = "Blessing";
int magic                     = 0;
string TradeComment;
string Filename;

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+

int init()
  {
   if (Symbol() == "AUDCADm" || Symbol() == "AUDCAD") magic = 101101;
   if (Symbol() == "AUDJPYm" || Symbol() == "AUDJPY") magic = 101102;
   if (Symbol() == "AUDNZDm" || Symbol() == "AUDNZD") magic = 101103;
   if (Symbol() == "AUDUSDm" || Symbol() == "AUDUSD") magic = 101104;
   if (Symbol() == "CHFJPYm" || Symbol() == "CHFJPY") magic = 101105;
   if (Symbol() == "EURAUDm" || Symbol() == "EURAUD") magic = 101106;
   if (Symbol() == "EURCADm" || Symbol() == "EURCAD") magic = 101107;
   if (Symbol() == "EURCHFm" || Symbol() == "EURCHF") magic = 101108;
   if (Symbol() == "EURGBPm" || Symbol() == "EURGBP") magic = 101109;
   if (Symbol() == "EURJPYm" || Symbol() == "EURJPY") magic = 101110;
   if (Symbol() == "EURUSDm" || Symbol() == "EURUSD") magic = 101111;
   if (Symbol() == "GBPCHFm" || Symbol() == "GBPCHF") magic = 101112;
   if (Symbol() == "GBPJPYm" || Symbol() == "GBPJPY") magic = 101113;
   if (Symbol() == "GBPUSDm" || Symbol() == "GBPUSD") magic = 101114;
   if (Symbol() == "NZDJPYm" || Symbol() == "NZDJPY") magic = 101115;
   if (Symbol() == "NZDUSDm" || Symbol() == "NZDUSD") magic = 101116;
   if (Symbol() == "USDCHFm" || Symbol() == "USDCHF") magic = 101117;
   if (Symbol() == "USDJPYm" || Symbol() == "USDJPY") magic = 101118;
   if (Symbol() == "USDCADm" || Symbol() == "USDCAD") magic = 101119;
   
   if (magic == 0) magic = 701999;
   
   TradeComment  = StringConcatenate(Symbol()," ",EA_name);      
   Filename = StringConcatenate(EA_name+"_",Symbol(),"_",Period(),"_M",".txt");
   
   return(0);
  }

//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+

int deinit()
  {
//----
   
//----
   return(0);
  }

//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+

int start()
  {
   int y;
   int cb=0; // Count buy
   int cs=0; // Count sell
   int cbl=0; // Count buy limit
   int csl=0; // Count sell limit
   int cbs=0; // Count buy limit
   int css=0; // Count sell limit
   double m,lot2;
   double lp; // last buy price
   double ll; //last lot
   double ltp; //last tp
   double lopt; // last open time
   int g2;
   double tp2;
   double entry;
   double pr=0; // profit;
   double sumlot,sumlot2;
   int lticket;
   double mp,mp2; // median price
   
//+------------------------------------------------------------------+
//| Money Management and Lot size coding                             |
//+------------------------------------------------------------------+
   
if(UseMM){lot=NormalizeDouble(AccountBalance()*Risk/1000000,2);}

//+------------------------------------------------------------------+
//| End Money Management Section                                     |
//+------------------------------------------------------------------+     

   if (MCbyMA ) {
     MC=-1;
     if (Bid<iMA(Symbol(),0,MA_Period,0,MODE_EMA,PRICE_CLOSE,0)) MC=1;
     if (Bid>iMA(Symbol(),0,MA_Period,0,MODE_EMA,PRICE_CLOSE,0)) MC=0;
     
}

 for (y = 0; y < OrdersTotal(); y++)
   {
      OrderSelect (y, SELECT_BY_POS, MODE_TRADES);
      if ((OrderMagicNumber()==magic) && (OrderSymbol()==Symbol()) && (OrderType()==OP_BUY)) {
        cb++;
        pr=pr+OrderProfit();
      }
      if ((OrderMagicNumber()==magic) && (OrderSymbol()==Symbol()) && (OrderType()==OP_SELL)) {
        cs++;
        pr=pr+OrderProfit();
      }
      if ((OrderMagicNumber()==magic) && (OrderSymbol()==Symbol()) && (OrderType()==OP_BUYLIMIT)) cbl++;
      if ((OrderMagicNumber()==magic) && (OrderSymbol()==Symbol()) && (OrderType()==OP_SELLLIMIT)) csl++;
      if ((OrderMagicNumber()==magic) && (OrderSymbol()==Symbol()) && (OrderType()==OP_BUYSTOP)) cbs++;
      if ((OrderMagicNumber()==magic) && (OrderSymbol()==Symbol()) && (OrderType()==OP_SELLSTOP)) css++;
   }
   
   if (cs==0 && cb==0 && cbs==0 && cbl==0 && css==0 && csl==0) ca=false;
   
   if (((cb>=BELevel || cs>=BELevel) && pr>0) || ca) {
     ca=true;
     for (y = 0; y < OrdersTotal(); y++)
     {
       OrderSelect (y, SELECT_BY_POS, MODE_TRADES);
       if ((OrderMagicNumber()==magic) && (OrderSymbol()==Symbol()) && (OrderType()==OP_BUY || OrderType()==OP_SELL)) OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),1);
       if ((OrderMagicNumber()==magic) && (OrderSymbol()==Symbol()) && (OrderType()==OP_BUYLIMIT || OrderType()==OP_SELLLIMIT || OrderType()==OP_BUYSTOP || OrderType()==OP_SELLSTOP)) OrderDelete(OrderTicket());
     }
     return;
   }

   g2=GridSet1;
   tp2=TP_Set1;

   if (cb>=Set1Count || cs>=Set1Count) {
     g2=GridSet2;
     tp2=TP_Set2;
   }

   if (cb>=Set2Count+Set1Count || cs>=Set2Count+Set1Count) {
     g2=GridSet3;
     tp2=TP_Set3;
   }
   
  
   if ((cb==0) && (cs==0)) {
     for (y = 0; y < OrdersTotal(); y++)
     {
       OrderSelect (y, SELECT_BY_POS, MODE_TRADES);
       if ((OrderMagicNumber()==magic) && (OrderSymbol()==Symbol()) && (OrderLots()>lot)) OrderDelete(OrderTicket());
     }


     if (MC==0) {
        if (cbs==0) {
          m=MathMod(Ask/Point,g2);
          if ((g2-m+d)>MarketInfo(Symbol(),MODE_STOPLEVEL)) {
            OrderSend(Symbol(),OP_BUYSTOP,lot,Ask*2-Bid+(g2-m+d)*Point,0,0,Ask*2-Bid+(g2-m+d+tp2)*Point,TradeComment,magic);
            Print("s2");
            return;
          }
        }
        if (cbl==0) {
          m=MathMod(Ask/Point,g2);
          if ((m+d)>MarketInfo(Symbol(),MODE_STOPLEVEL)) {
            OrderSend(Symbol(),OP_BUYLIMIT,lot,Ask*2-Bid-(m+d)*Point,0,0,Ask*2-Bid-(m+d-tp2)*Point,TradeComment,magic);
            Print("s1");
            return;
          }
        }
     }

     if (MC==1) {
        if (csl==0) {
          m=MathMod(Bid/Point,g2);
          if ((g2-m-d)>MarketInfo(Symbol(),MODE_STOPLEVEL)) {
            OrderSend(Symbol(),OP_SELLLIMIT,lot,Bid+(g2-m-d)*Point,0,0,Bid+(g2-m-d-tp2)*Point,TradeComment,magic);
            Print("s2");
            return;
          }
        }
        if (css==0) {
          m=MathMod(Bid/Point,g2);
          if ((m+d)>MarketInfo(Symbol(),MODE_STOPLEVEL)) {
            OrderSend(Symbol(),OP_SELLSTOP,lot,Bid-(m+d)*Point,0,0,Bid-(m+d+tp2)*Point,TradeComment,magic);
            Print("s1");
            return;
          }
        }
     }
        
     
     if (MC==2) {
        if (css==0) {
          m=MathMod(Bid/Point,g2);
          if ((m+d)>MarketInfo(Symbol(),MODE_STOPLEVEL)) {
            OrderSend(Symbol(),OP_SELLSTOP,lot,Bid-(m+d)*Point,0,0,Bid-(m+d+tp2)*Point,TradeComment,magic);
            Print("s1");
            return;
          }
        }
        if (cbs==0) {
          m=MathMod(Ask/Point,g2);
          if ((g2-m+d)>MarketInfo(Symbol(),MODE_STOPLEVEL)) {
            OrderSend(Symbol(),OP_BUYSTOP,lot,Ask*2-Bid+(g2-m+d)*Point,0,0,Ask*2-Bid+(g2-m+d+tp2)*Point,TradeComment,magic);
            Print("s2");
            return;
          }
        }
      }

   }
   
   if (cb>0 || cs>0) {
     for (y = 0; y < OrdersTotal(); y++)
     {
        OrderSelect (y, SELECT_BY_POS, MODE_TRADES);
        if ((OrderMagicNumber()==magic) && (OrderSymbol()==Symbol()) && (OrderType()!=OP_SELL) && (OrderType()!=OP_BUY) && OrderLots()==lot) OrderDelete(OrderTicket());
     }
   }
   
   
   if (cb>0) {
     sumlot=0;
     mp=0;
     for (y = 0; y < OrdersTotal(); y++)
     {
       OrderSelect (y, SELECT_BY_POS, MODE_TRADES);
       if ((OrderMagicNumber() != magic) || (OrderType()!=OP_BUY) || (OrderSymbol()!=Symbol())) { continue; }
       lp=OrderOpenPrice();
       ll=OrderLots();
       ltp=OrderTakeProfit();
       lopt=OrderOpenTime();
       lticket=OrderTicket();
       sumlot=sumlot+ll;
       mp=mp+ll*lp;
     }
     mp=mp/sumlot;
     

       if ((TimeCurrent()-TimeGrid>lopt) && (cb<MaxLevel)) {
         if (lp>Ask) entry=NormalizeDouble(lp-(MathRound((lp-Ask)/Point/g2)+1)*g2*Point,Digits); else entry=NormalizeDouble(lp-g2*Point,Digits);
         if (Micro) lot2=NormalizeDouble(ll*Multiplier+LotInc,2); else lot2=NormalizeDouble(ll*Multiplier+LotInc,1);


         
         if (cbl==0) {
           OrderSend(Symbol(),OP_BUYLIMIT,lot2,entry,0,0,entry+tp2*Point,TradeComment,magic);
           Print("s3");
           return;
         }

         if (cbl==1) {
           for (y = 0; y < OrdersTotal(); y++)
           {
              OrderSelect (y, SELECT_BY_POS, MODE_TRADES);
              if (OrderType()==OP_BUYLIMIT && OrderMagicNumber()==magic && (OrderSymbol()==Symbol()) && entry-OrderOpenPrice()>g2/2*Point) {
                OrderModify(OrderTicket(),entry,OrderStopLoss(),entry+tp2*Point,0);
                Print("mo1");
              }
            }
         }
         
       } 


     for (y = 0; y < OrdersTotal(); y++) // Sync TPs
     {
       OrderSelect (y, SELECT_BY_POS, MODE_TRADES);
       if ((OrderMagicNumber() != magic) || (OrderType()!=OP_BUY) || (MathAbs(OrderTakeProfit()-ltp)<Point) || (OrderSymbol()!=Symbol())) { continue; }
       OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),ltp,0,Red);
       Print("m1");
       return;
     }
     
   }

   if (cs>0) {
     sumlot=0;
     mp=0;
     for (y = 0; y < OrdersTotal(); y++)
     {
       OrderSelect (y, SELECT_BY_POS, MODE_TRADES);
       if ((OrderMagicNumber() != magic) || (OrderType()!=OP_SELL) || (OrderSymbol()!=Symbol())) { continue; }
       lp=OrderOpenPrice();
       ll=OrderLots();
       ltp=OrderTakeProfit();
       lopt=OrderOpenTime();
       lticket=OrderTicket();
       sumlot=sumlot+ll;
       mp=mp+ll*lp;
     }
     mp=mp/sumlot;
     

       if ((TimeCurrent()-TimeGrid>lopt) && (cs<MaxLevel)) {

         if (Bid>lp) entry=NormalizeDouble(lp+(MathRound((-lp+Bid)/Point/g2)+1)*g2*Point,Digits); else entry=NormalizeDouble(lp+g2*Point,Digits);
         if (Micro) lot2=NormalizeDouble(ll*Multiplier+LotInc,2); else lot2=NormalizeDouble(ll*Multiplier+LotInc,1);
         if (csl==0) {
            OrderSend(Symbol(),OP_SELLLIMIT,lot2,entry,0,0,entry-tp2*Point,TradeComment,magic);
            Print("s4");
            return;
         }

         if (csl==1) {
           for (y = 0; y < OrdersTotal(); y++)
           {
              OrderSelect (y, SELECT_BY_POS, MODE_TRADES);
              if (OrderType()==OP_SELLLIMIT && OrderMagicNumber()==magic && (OrderSymbol()==Symbol()) && OrderOpenPrice()-entry>g2/2*Point) {
                OrderModify(OrderTicket(),entry,OrderStopLoss(),entry-tp2*Point,0);
                Print("mo2");
              }
            }
         }
         
         
         
       }


     for (y = 0; y < OrdersTotal(); y++) // Sync TPs
     {
       OrderSelect (y, SELECT_BY_POS, MODE_TRADES);
       if ((OrderMagicNumber() != magic) || (OrderType()!=OP_SELL) || (MathAbs(OrderTakeProfit()-ltp)<Point) || (OrderSymbol()!=Symbol())) { continue; }
       OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),ltp,0,Red);
       Print("m2");
       return;
     }
   }
   
  
   return(0);
  }
//+------------------------------------------------------------------+
//| expert end function                                              |
//+------------------------------------------------------------------+

Profitability Reports

PERFORMANCE BY SYMBOL

Expected payoff

Average expected payoff across the available backtests for each symbol.

Positive Negative
11 reports
NZD/USD Jul 2025 - Sep 2025
1.18
Total Trades 1079
Won Trades 736
Lost trades 343
Win Rate 68.21 %
Expected payoff 0.39
Gross Profit 2744.00
Gross Loss -2327.80
Total Net Profit 416.20
-100%
-50%
0%
50%
100%
EUR/USD Oct 2025 - Feb 2026
1.13
Total Trades 2429
Won Trades 1681
Lost trades 748
Win Rate 69.21 %
Expected payoff 0.29
Gross Profit 6127.25
Gross Loss -5419.34
Total Net Profit 707.91
-100%
-50%
0%
50%
100%
USD/CAD Jul 2025 - Sep 2025
1.06
Total Trades 1378
Won Trades 952
Lost trades 426
Win Rate 69.09 %
Expected payoff 0.09
Gross Profit 2111.57
Gross Loss -1991.57
Total Net Profit 120.00
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
1.05
Total Trades 1130
Won Trades 786
Lost trades 344
Win Rate 69.56 %
Expected payoff 0.12
Gross Profit 2723.00
Gross Loss -2583.93
Total Net Profit 139.07
-100%
-50%
0%
50%
100%
USD/CAD Oct 2024 - Jan 2025
0.96
Total Trades 1771
Won Trades 1232
Lost trades 539
Win Rate 69.57 %
Expected payoff -0.06
Gross Profit 2886.55
Gross Loss -3000.10
Total Net Profit -113.55
-100%
-50%
0%
50%
100%
AUD/USD Oct 2025 - Feb 2026
0.88
Total Trades 982
Won Trades 675
Lost trades 307
Win Rate 68.74 %
Expected payoff -0.34
Gross Profit 2416.02
Gross Loss -2749.31
Total Net Profit -333.29
-100%
-50%
0%
50%
100%
GBP/USD Jul 2025 - Sep 2025
0.70
Total Trades 1772
Won Trades 1174
Lost trades 598
Win Rate 66.25 %
Expected payoff -0.88
Gross Profit 3550.25
Gross Loss -5105.23
Total Net Profit -1554.98
-100%
-50%
0%
50%
100%
USD/JPY Jul 2025 - Sep 2025
0.68
Total Trades 2419
Won Trades 1673
Lost trades 746
Win Rate 69.16 %
Expected payoff -0.51
Gross Profit 2593.99
Gross Loss -3823.49
Total Net Profit -1229.50
-100%
-50%
0%
50%
100%
GBP/CAD Oct 2025 - Feb 2026
0.23
Total Trades 1039
Won Trades 626
Lost trades 413
Win Rate 60.25 %
Expected payoff -5.76
Gross Profit 1769.53
Gross Loss -7752.01
Total Net Profit -5982.48
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
0.15
Total Trades 490
Won Trades 317
Lost trades 173
Win Rate 64.69 %
Expected payoff -15.07
Gross Profit 1323.75
Gross Loss -8707.43
Total Net Profit -7383.68
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
0.02
Total Trades 182
Won Trades 115
Lost trades 67
Win Rate 63.19 %
Expected payoff -174.23
Gross Profit 503.25
Gross Loss -32212.42
Total Net Profit -31709.17
-100%
-50%
0%
50%
100%

Comments