Profit factor:
1.24
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
9 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

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/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%
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%
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 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.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%
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%
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%
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%
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%

Comments