Waddah Attar Win

Download script
Profit factor:
1.80

This trading script is designed to automate a specific grid-based strategy on the MetaTrader platform. It manages both buy and sell positions simultaneously by placing pending orders at set intervals, aiming to capture market movements regardless of direction.

Core Operational Logic

1. Profit Monitoring and Reset The system continuously tracks your account balance. It is programmed with a specific profit target (defined as a minimum dollar amount). Once the account equity reaches this target, the script automatically closes all open positions and deletes any remaining pending orders. After hitting this goal, it resets its memory to begin a new cycle.

2. Initial Trade Placement When the script starts or after clearing previous trades, it identifies that no active orders exist for its specific ID. It then immediately places two "Limit" orders:

  • A Buy Limit order placed a fixed distance below the current market price.
  • A Sell Limit order placed a fixed distance above the current market price.

3. Dynamic Grid Expansion The script monitors the prices of the most recent buy and sell orders. If the market moves significantly toward these positions, it automatically places new pending orders at consistent intervals (the "Step").

  • If the price approaches an existing Buy Limit, it places another one further down.
  • If the price approaches an existing Sell Limit, it places another one further up.

This creates a "grid" of potential entries, ensuring that as the market fluctuates, the script maintains a presence in both directions.

4. Automated Management To ensure the system runs independently, it utilizes a unique "Magic Number." This allows the script to distinguish its own trades from any other manual trades or different automated systems you might be running on the same account. It specifically handles:

  • Closing only the trades it opened.
  • Deleting only the pending orders it created.
  • Calculating the correct lot sizes based on the initial parameters provided.

Summary for the User

In simple terms, this is a grid trading bot. It places "safety nets" (limit orders) both above and below the current price. As the market moves, it builds a ladder of these orders. Once your account hits the profit goal you defined, it wipes the board clean and starts the process over again.

Orders Execution
It automatically opens orders when conditions are reachedChecks for the total of open ordersIt Closes Orders by itself
15 Views
0 Downloads
1 Favorites
Waddah Attar Win
#property link      "waddahattar@hotmail.com"
 
extern int     Step=120;
extern double  FirstLot=0.1;
extern double  IncLot=0;
extern double  MinProfit=450;
extern int     Magic = 2008;

double gLotSell=0;
double gLotBuy=0;
double LSP,LBP;

int init()
{
  Comment("Waddah Attar Win");
  GlobalVariableSet("OldBalance",AccountBalance());
  return(0);
}
int deinit()
{
  Comment("");
  return(0);
}
int start()
{
  double i;
  double sl,p;

  if (AccountEquity()>=GlobalVariableGet("OldBalance")+MinProfit)
  {
    DeletePendingOrders(Magic);
    CloseOrders(Magic);
    GlobalVariableSet("OldBalance",0);
  }

  GlobalVariableSet("OldBalance",AccountBalance());

  if (MyOrdersTotal(Magic)==0)
  {
    OrderSend(Symbol(),OP_BUYLIMIT,FirstLot,Ask-Step*Point,3,0,0,"",Magic,0,Green);
    OrderSend(Symbol(),OP_SELLLIMIT,FirstLot,Bid+Step*Point,3,0,0,"",Magic,0,Red);
  }

  LSP=GetLastSellPrice(Magic);
  LBP=GetLastBuyPrice(Magic);
  
  if((LSP-Bid)<=5*Point)
  {
    OrderSend(Symbol(),OP_SELLLIMIT,gLotSell+IncLot,LSP+Step*Point,3,0,0,"",Magic,0,Red);
  }

  if((Ask-LBP)<=5*Point)
  {
    OrderSend(Symbol(),OP_BUYLIMIT,gLotBuy+IncLot,LBP-Step*Point,3,0,0,"",Magic,0,Red);
  }

  return(0);
}

int DeletePendingOrders(int Magic)
{
  int total  = OrdersTotal();
  
  for (int cnt = total-1 ; cnt >= 0 ; cnt--)
  {
    OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
    if (OrderMagicNumber() == Magic && OrderSymbol()==Symbol() && (OrderType()!=OP_BUY || OrderType()!=OP_SELL))
    {
      OrderDelete(OrderTicket());
    }
  }
  return(0);
}

int CloseOrders(int Magic)
{
  int total  = OrdersTotal();
  
  for (int cnt = total-1 ; cnt >= 0 ; cnt--)
  {
    OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
    if (OrderMagicNumber() == Magic && OrderSymbol()==Symbol())
    {
      if (OrderType()==OP_BUY)
      {
        OrderClose(OrderTicket(),OrderLots(),Bid,3);
      }
      
      if (OrderType()==OP_SELL)
      {
        OrderClose(OrderTicket(),OrderLots(),Ask,3);
      }
    }
  }
  return(0);
}

int MyOrdersTotal(int Magic)
{
  int c=0;
  int total  = OrdersTotal();

  for (int cnt = 0 ; cnt < total ; cnt++)
  {
    OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
    if (OrderMagicNumber() == Magic && OrderSymbol()==Symbol())
    {
      c++;
    }
  }
  return(c);
}

double GetLastBuyPrice(int Magic)
{
  int total=OrdersTotal()-1;

  for (int cnt = total ; cnt >=0 ; cnt--)
  {
    OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
    if (OrderMagicNumber() == Magic && OrderSymbol()==Symbol() && (OrderType()==OP_BUYLIMIT || OrderType()==OP_BUY))
    {
      gLotBuy=OrderLots();
      return(OrderOpenPrice());
      break;
    }
  }
  return(0);
}

double GetLastSellPrice(int Magic)
{
  int total=OrdersTotal()-1;

  for (int cnt = total ; cnt >=0 ; cnt--)
  {
    OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
    if (OrderMagicNumber() == Magic && OrderSymbol()==Symbol() && (OrderType()==OP_SELLLIMIT ||OrderType()==OP_SELL))
    {
      gLotSell=OrderLots();
      return(OrderOpenPrice());
      break;
    }
  }
  return(100000);
}

Profitability Reports

PERFORMANCE BY SYMBOL

Expected payoff

Average expected payoff across the available backtests for each symbol.

Positive Negative
33 reports
USD/CAD Jul 2025 - Sep 2025
6.50
Total Trades 77
Won Trades 54
Lost trades 23
Win Rate 70.13 %
Expected payoff 29.78
Gross Profit 2710.13
Gross Loss -416.94
Total Net Profit 2293.19
-100%
-50%
0%
50%
100%
USD/CAD Jul 2025 - Sep 2025
4.54
Total Trades 84
Won Trades 55
Lost trades 29
Win Rate 65.48 %
Expected payoff 25.88
Gross Profit 2787.28
Gross Loss -613.68
Total Net Profit 2173.60
-100%
-50%
0%
50%
100%
NZD/USD Jul 2025 - Sep 2025
3.74
Total Trades 65
Won Trades 43
Lost trades 22
Win Rate 66.15 %
Expected payoff 26.62
Gross Profit 2362.70
Gross Loss -632.20
Total Net Profit 1730.50
-100%
-50%
0%
50%
100%
NZD/USD Jul 2025 - Sep 2025
3.74
Total Trades 65
Won Trades 42
Lost trades 23
Win Rate 64.62 %
Expected payoff 26.58
Gross Profit 2359.80
Gross Loss -631.80
Total Net Profit 1728.00
-100%
-50%
0%
50%
100%
USD/CHF Jul 2025 - Sep 2025
3.38
Total Trades 92
Won Trades 58
Lost trades 34
Win Rate 63.04 %
Expected payoff 36.07
Gross Profit 4711.78
Gross Loss -1393.10
Total Net Profit 3318.68
-100%
-50%
0%
50%
100%
USD/CHF Jul 2025 - Sep 2025
3.13
Total Trades 93
Won Trades 58
Lost trades 35
Win Rate 62.37 %
Expected payoff 35.66
Gross Profit 4870.59
Gross Loss -1554.22
Total Net Profit 3316.37
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
2.80
Total Trades 164
Won Trades 105
Lost trades 59
Win Rate 64.02 %
Expected payoff 24.78
Gross Profit 6324.01
Gross Loss -2260.80
Total Net Profit 4063.21
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
2.60
Total Trades 60
Won Trades 40
Lost trades 20
Win Rate 66.67 %
Expected payoff 27.27
Gross Profit 2657.70
Gross Loss -1021.50
Total Net Profit 1636.20
-100%
-50%
0%
50%
100%
GBP/USD Jul 2025 - Sep 2025
2.59
Total Trades 181
Won Trades 117
Lost trades 64
Win Rate 64.64 %
Expected payoff 27.36
Gross Profit 8056.30
Gross Loss -3104.80
Total Net Profit 4951.50
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
2.59
Total Trades 60
Won Trades 40
Lost trades 20
Win Rate 66.67 %
Expected payoff 27.21
Gross Profit 2658.20
Gross Loss -1025.30
Total Net Profit 1632.90
-100%
-50%
0%
50%
100%
GBP/USD Jul 2025 - Sep 2025
2.59
Total Trades 181
Won Trades 117
Lost trades 64
Win Rate 64.64 %
Expected payoff 27.36
Gross Profit 8056.30
Gross Loss -3104.80
Total Net Profit 4951.50
-100%
-50%
0%
50%
100%
USD/JPY Jul 2025 - Sep 2025
2.49
Total Trades 246
Won Trades 164
Lost trades 82
Win Rate 66.67 %
Expected payoff 23.49
Gross Profit 9654.67
Gross Loss -3876.14
Total Net Profit 5778.53
-100%
-50%
0%
50%
100%
USD/JPY Jan 2025 - Jul 2025
2.39
Total Trades 1043
Won Trades 695
Lost trades 348
Win Rate 66.63 %
Expected payoff 22.20
Gross Profit 39761.74
Gross Loss -16608.26
Total Net Profit 23153.48
-100%
-50%
0%
50%
100%
EUR/USD Oct 2025 - Feb 2026
2.35
Total Trades 159
Won Trades 102
Lost trades 57
Win Rate 64.15 %
Expected payoff 27.67
Gross Profit 7654.80
Gross Loss -3255.30
Total Net Profit 4399.50
-100%
-50%
0%
50%
100%
USD/JPY Jul 2025 - Sep 2025
2.25
Total Trades 256
Won Trades 167
Lost trades 89
Win Rate 65.23 %
Expected payoff 21.40
Gross Profit 9855.06
Gross Loss -4376.02
Total Net Profit 5479.04
-100%
-50%
0%
50%
100%
GBP/CAD Oct 2024 - Jan 2025
1.89
Total Trades 224
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff 18.36
Gross Profit 8734.49
Gross Loss -4622.13
Total Net Profit 4112.36
-100%
-50%
0%
50%
100%
GBP/CAD Oct 2025 - Feb 2026
1.77
Total Trades 241
Won Trades 152
Lost trades 89
Win Rate 63.07 %
Expected payoff 14.93
Gross Profit 8290.51
Gross Loss -4693.07
Total Net Profit 3597.44
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
1.60
Total Trades 207
Won Trades 131
Lost trades 76
Win Rate 63.29 %
Expected payoff 13.33
Gross Profit 7341.98
Gross Loss -4582.23
Total Net Profit 2759.75
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
1.59
Total Trades 142
Won Trades 79
Lost trades 63
Win Rate 55.63 %
Expected payoff 14.17
Gross Profit 5398.70
Gross Loss -3387.02
Total Net Profit 2011.68
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
1.58
Total Trades 207
Won Trades 132
Lost trades 75
Win Rate 63.77 %
Expected payoff 13.02
Gross Profit 7361.96
Gross Loss -4666.38
Total Net Profit 2695.58
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
0.89
Total Trades 17
Won Trades 8
Lost trades 9
Win Rate 47.06 %
Expected payoff -6178.72
Gross Profit 843944.80
Gross Loss -948983.00
Total Net Profit -105038.20
-100%
-50%
0%
50%
100%
NZD/USD Jan 2025 - Jul 2025
0.61
Total Trades 157
Won Trades 85
Lost trades 72
Win Rate 54.14 %
Expected payoff -25.72
Gross Profit 6410.00
Gross Loss -10447.60
Total Net Profit -4037.60
-100%
-50%
0%
50%
100%
GBP/CAD Jan 2025 - Jul 2025
0.55
Total Trades 211
Won Trades 92
Lost trades 119
Win Rate 43.60 %
Expected payoff -37.81
Gross Profit 9723.76
Gross Loss -17702.39
Total Net Profit -7978.63
-100%
-50%
0%
50%
100%
GBP/AUD Jan 2025 - Jul 2025
0.45
Total Trades 191
Won Trades 85
Lost trades 106
Win Rate 44.50 %
Expected payoff -42.35
Gross Profit 6640.75
Gross Loss -14729.56
Total Net Profit -8088.81
-100%
-50%
0%
50%
100%
GBP/AUD Oct 2025 - Feb 2026
0.35
Total Trades 151
Won Trades 65
Lost trades 86
Win Rate 43.05 %
Expected payoff -53.57
Gross Profit 4284.21
Gross Loss -12373.85
Total Net Profit -8089.64
-100%
-50%
0%
50%
100%
USD/CHF Jan 2025 - Jul 2025
0.32
Total Trades 112
Won Trades 57
Lost trades 55
Win Rate 50.89 %
Expected payoff -71.44
Gross Profit 3723.14
Gross Loss -11724.55
Total Net Profit -8001.41
-100%
-50%
0%
50%
100%
AUD/USD Oct 2025 - Feb 2026
0.14
Total Trades 81
Won Trades 31
Lost trades 50
Win Rate 38.27 %
Expected payoff -113.11
Gross Profit 1506.00
Gross Loss -10668.00
Total Net Profit -9162.00
-100%
-50%
0%
50%
100%
AUD/USD Jan 2025 - Jul 2025
0.06
Total Trades 140
Won Trades 88
Lost trades 52
Win Rate 62.86 %
Expected payoff -7735.75
Gross Profit 63052.90
Gross Loss -1146057.80
Total Net Profit -1083004.90
-100%
-50%
0%
50%
100%
EUR/USD Jan 2025 - Jul 2025
0.01
Total Trades 136
Won Trades 85
Lost trades 51
Win Rate 62.50 %
Expected payoff -6992.74
Gross Profit 6163.50
Gross Loss -957176.50
Total Net Profit -951013.00
-100%
-50%
0%
50%
100%
AUD/USD Oct 2024 - Jan 2025
0.00
Total Trades 37
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -225.30
Gross Profit 0.00
Gross Loss -8336.10
Total Net Profit -8336.10
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
0.00
Total Trades 35
Won Trades 0
Lost trades 35
Win Rate 0.00 %
Expected payoff -205.80
Gross Profit 0.00
Gross Loss -7203.00
Total Net Profit -7203.00
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
0.00
Total Trades 39
Won Trades 0
Lost trades 39
Win Rate 0.00 %
Expected payoff -239.00
Gross Profit 0.00
Gross Loss -9321.00
Total Net Profit -9321.00
-100%
-50%
0%
50%
100%
USD/CAD Oct 2024 - Jan 2025
0.00
Total Trades 45
Won Trades 0
Lost trades 45
Win Rate 0.00 %
Expected payoff -197.24
Gross Profit 0.00
Gross Loss -8875.82
Total Net Profit -8875.82
-100%
-50%
0%
50%
100%

Comments