Profit factor:
1.26
Price Data Components
Series array that contains open time of each bar
Orders Execution
Checks for the total of open ordersIt Closes Orders by itself It automatically opens orders when conditions are reached
10 Views
0 Downloads
0 Favorites
sell_buy
//+------------------------------------------------------------------+
//|                                                     sell&buy.mq4 |
//+------------------------------------------------------------------+

extern double lots=0.1;
extern double target=4;
int cbars=0;
int magic=9348670;
int dist=24;

int start() {

 double profit=0;
 int j=OrdersTotal()-1;
 for (int i=j;i>=0;i--)
  {
   OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
   if(OrderMagicNumber()==magic && OrderSymbol()==Symbol())
   profit=OrderProfit()+OrderSwap()+profit;
  }
 
 if (profit>=target)
  {
   j=OrdersTotal()-1;
   for (i=j;i>=0;i--)
    {
     OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
     RefreshRates();
     if(OrderType()==OP_BUY && OrderMagicNumber()==magic && OrderSymbol()==Symbol())
      OrderClose(OrderTicket(),OrderLots(),Bid,3,Blue);
    }
  }
 
 double sig = Lowest(NULL,0,MODE_LOW,dist,0);
 if(cbars!=Bars && sig==1)
  {
   RefreshRates();
   OrderSend(Symbol(),OP_BUY,lots,Ask,3,0,0,"buy",magic,0,Blue);
   string AN="ArrBuy "+TimeToStr(CurTime());
   ObjectCreate(AN,OBJ_ARROW,0,Time[1],Low[1]-6*Point,0,0,0,0);
   ObjectSet(AN, OBJPROP_ARROWCODE, 233);
   ObjectSet(AN, OBJPROP_COLOR , Blue);
  }

 profit=0;
 j=OrdersTotal()-1;
 for (i=j;i>=0;i--)
  {
   OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
   if(OrderType()==OP_SELL && OrderMagicNumber()==magic && OrderSymbol()==Symbol())
   profit=OrderProfit()+OrderSwap()+profit;
  }
 
 if (profit>=target)
  {
   j=OrdersTotal()-1;
   for (i=j;i>=0;i--)
    {
     OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
     RefreshRates();
     if(OrderType()==OP_SELL && OrderMagicNumber()==magic && OrderSymbol()==Symbol())
      OrderClose(OrderTicket(),OrderLots(),Ask,3,Magenta);
    }
  }
 
 sig = Highest(NULL,0,MODE_HIGH,dist,0);
 if(cbars!=Bars && sig==1)
  {
   RefreshRates();
   OrderSend(Symbol(),OP_SELL,lots,Bid,3,0,0,"sell",magic,0,Magenta);
   AN="ArrSell "+TimeToStr(CurTime());
   ObjectCreate(AN,OBJ_ARROW,0,Time[1],High[1]+6*Point,0,0,0,0);
   ObjectSet(AN, OBJPROP_ARROWCODE, 234);
   ObjectSet(AN, OBJPROP_COLOR , Magenta);
  }

 cbars=Bars;
 
 return(0);
}

Profitability Reports

USD/CHF Jul 2025 - Sep 2025
1.87
Total Trades 269
Won Trades 208
Lost trades 61
Win Rate 77.32 %
Expected payoff 2.43
Gross Profit 1401.08
Gross Loss -748.05
Total Net Profit 653.03
-100%
-50%
0%
50%
100%
AUD/USD Jan 2025 - Jul 2025
1.74
Total Trades 662
Won Trades 492
Lost trades 170
Win Rate 74.32 %
Expected payoff 1.99
Gross Profit 3081.60
Gross Loss -1766.50
Total Net Profit 1315.10
-100%
-50%
0%
50%
100%
NZD/USD Jan 2025 - Jul 2025
1.74
Total Trades 708
Won Trades 527
Lost trades 181
Win Rate 74.44 %
Expected payoff 1.95
Gross Profit 3258.10
Gross Loss -1874.80
Total Net Profit 1383.30
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
1.73
Total Trades 293
Won Trades 209
Lost trades 84
Win Rate 71.33 %
Expected payoff 1.87
Gross Profit 1296.44
Gross Loss -749.56
Total Net Profit 546.88
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
1.70
Total Trades 326
Won Trades 236
Lost trades 90
Win Rate 72.39 %
Expected payoff 1.90
Gross Profit 1507.50
Gross Loss -887.60
Total Net Profit 619.90
-100%
-50%
0%
50%
100%
USD/CAD Jan 2025 - Jul 2025
1.66
Total Trades 660
Won Trades 495
Lost trades 165
Win Rate 75.00 %
Expected payoff 2.30
Gross Profit 3803.79
Gross Loss -2288.80
Total Net Profit 1514.99
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
1.65
Total Trades 632
Won Trades 457
Lost trades 175
Win Rate 72.31 %
Expected payoff 1.53
Gross Profit 2452.70
Gross Loss -1486.60
Total Net Profit 966.10
-100%
-50%
0%
50%
100%
USD/JPY Jan 2025 - Jul 2025
1.60
Total Trades 667
Won Trades 515
Lost trades 152
Win Rate 77.21 %
Expected payoff 2.46
Gross Profit 4358.67
Gross Loss -2719.85
Total Net Profit 1638.82
-100%
-50%
0%
50%
100%
USD/JPY Jul 2025 - Sep 2025
1.58
Total Trades 330
Won Trades 250
Lost trades 80
Win Rate 75.76 %
Expected payoff 2.23
Gross Profit 1995.86
Gross Loss -1260.50
Total Net Profit 735.36
-100%
-50%
0%
50%
100%
USD/CHF Jul 2025 - Sep 2025
1.57
Total Trades 587
Won Trades 410
Lost trades 177
Win Rate 69.85 %
Expected payoff 1.79
Gross Profit 2899.90
Gross Loss -1850.15
Total Net Profit 1049.75
-100%
-50%
0%
50%
100%
AUD/USD Oct 2024 - Jan 2025
1.56
Total Trades 322
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff 2.10
Gross Profit 1883.50
Gross Loss -1208.80
Total Net Profit 674.70
-100%
-50%
0%
50%
100%
USD/JPY Jul 2025 - Sep 2025
1.51
Total Trades 674
Won Trades 488
Lost trades 186
Win Rate 72.40 %
Expected payoff 1.80
Gross Profit 3613.63
Gross Loss -2400.77
Total Net Profit 1212.86
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
1.36
Total Trades 324
Won Trades 228
Lost trades 96
Win Rate 70.37 %
Expected payoff 1.83
Gross Profit 2248.21
Gross Loss -1654.29
Total Net Profit 593.92
-100%
-50%
0%
50%
100%
USD/CHF Jan 2025 - Jul 2025
1.32
Total Trades 638
Won Trades 479
Lost trades 159
Win Rate 75.08 %
Expected payoff 2.45
Gross Profit 6447.96
Gross Loss -4882.96
Total Net Profit 1565.00
-100%
-50%
0%
50%
100%
USD/CAD Jul 2025 - Sep 2025
1.31
Total Trades 315
Won Trades 220
Lost trades 95
Win Rate 69.84 %
Expected payoff 1.47
Gross Profit 1980.84
Gross Loss -1517.75
Total Net Profit 463.09
-100%
-50%
0%
50%
100%
USD/CAD Jul 2025 - Sep 2025
1.30
Total Trades 641
Won Trades 441
Lost trades 200
Win Rate 68.80 %
Expected payoff 1.21
Gross Profit 3344.88
Gross Loss -2570.58
Total Net Profit 774.30
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
1.29
Total Trades 643
Won Trades 380
Lost trades 263
Win Rate 59.10 %
Expected payoff 1.78
Gross Profit 5155.30
Gross Loss -4010.03
Total Net Profit 1145.27
-100%
-50%
0%
50%
100%
GBP/AUD Jan 2025 - Jul 2025
1.27
Total Trades 700
Won Trades 495
Lost trades 205
Win Rate 70.71 %
Expected payoff 1.73
Gross Profit 5687.74
Gross Loss -4473.87
Total Net Profit 1213.87
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
1.25
Total Trades 324
Won Trades 243
Lost trades 81
Win Rate 75.00 %
Expected payoff 2.29
Gross Profit 3653.70
Gross Loss -2912.10
Total Net Profit 741.60
-100%
-50%
0%
50%
100%
USD/CAD Oct 2024 - Jan 2025
1.22
Total Trades 324
Won Trades 211
Lost trades 113
Win Rate 65.12 %
Expected payoff 1.48
Gross Profit 2665.27
Gross Loss -2185.06
Total Net Profit 480.21
-100%
-50%
0%
50%
100%
NZD/USD Jul 2025 - Sep 2025
1.13
Total Trades 338
Won Trades 247
Lost trades 91
Win Rate 73.08 %
Expected payoff 0.52
Gross Profit 1558.10
Gross Loss -1383.30
Total Net Profit 174.80
-100%
-50%
0%
50%
100%
NZD/USD Jul 2025 - Sep 2025
1.11
Total Trades 644
Won Trades 446
Lost trades 198
Win Rate 69.25 %
Expected payoff 0.52
Gross Profit 3328.40
Gross Loss -2992.50
Total Net Profit 335.90
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
0.75
Total Trades 75
Won Trades 52
Lost trades 23
Win Rate 69.33 %
Expected payoff -1424.94
Gross Profit 316138.40
Gross Loss -423008.80
Total Net Profit -106870.40
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
0.41
Total Trades 325
Won Trades 169
Lost trades 156
Win Rate 52.00 %
Expected payoff -16.25
Gross Profit 3601.27
Gross Loss -8882.98
Total Net Profit -5281.71
-100%
-50%
0%
50%
100%
GBP/CAD Jan 2025 - Jul 2025
0.30
Total Trades 212
Won Trades 113
Lost trades 99
Win Rate 53.30 %
Expected payoff -40.84
Gross Profit 3770.68
Gross Loss -12428.05
Total Net Profit -8657.37
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
0.00
Total Trades 79
Won Trades 15
Lost trades 64
Win Rate 18.99 %
Expected payoff -94.70
Gross Profit 34.70
Gross Loss -7515.70
Total Net Profit -7481.00
-100%
-50%
0%
50%
100%
EUR/USD Jan 2025 - Jul 2025
0.00
Total Trades 214
Won Trades 152
Lost trades 62
Win Rate 71.03 %
Expected payoff -7590.32
Gross Profit 895.40
Gross Loss -1625223.80
Total Net Profit -1624328.40
-100%
-50%
0%
50%
100%

Comments