Author: Ugar
Profit factor:
0.14
Price Data Components
Series array that contains open prices of each barSeries array that contains close prices for each bar
Orders Execution
Checks for the total of open ordersIt automatically opens orders when conditions are reached
0 Views
0 Downloads
0 Favorites
D1_Trend
//+------------------------------------------------------------------+
//|                                                     D1_Trend.mq4 |
//|                                                             Ugar |
//|                                                     ugar68@bk.ru |
//+------------------------------------------------------------------+
#property copyright "Ugar"
#property link      "ugar68@bk.ru"

//---- input parameters
extern int       TP=200;
extern int       SL=50;
extern int       Filter=100;
extern double    Lot=0.1;
extern int MinutesOpen=10;
extern int Slippage=3;

static int  Magic=90819;
static double PointK;
static int K;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   if(MarketInfo("EURUSD",MODE_DIGITS)==5)K=10;
   else K=1;
   PointK=K*Point;
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
   bool trade=true;
   int ticket;
   datetime opentime=iTime(NULL,1440,0);
   datetime endopentime=opentime+MinutesOpen*60;
   if(TimeCurrent()>endopentime)return(0);
   else Print("âðåìÿ îòêðûòèÿ");
   
   int orders=OrdersTotal();
   for(int i=orders-1; i>=0;i--)
      {
      if(!OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
         {
         Print("Îðäåð íå âûáðàí, îøèáêà ", GetLastError());
         continue;
         }
      if(OrderSymbol()!=Symbol() || OrderMagicNumber()!=Magic)continue;
      if(OrderOpenTime()>=opentime)trade=false;
      }
   if(!trade)return(0);
   double OD1=iOpen(NULL,1440,1);
   double CD1=iClose(NULL,1440,1);
   if((CD1-OD1)/PointK>Filter)
      {
      ticket=OrderSend(Symbol(),OP_BUY,Lot,Ask,Slippage*K,Bid-SL*PointK,Bid+TP*PointK,0,Magic,
      0,Green);
      if(ticket<0)Print("Îøèáêà îòêðûòèÿ Buy îðäåðà ", GetLastError());
      }
   if((OD1-CD1)/PointK>Filter)
      {
      ticket=OrderSend(Symbol(),OP_SELL,Lot,Bid,Slippage*K,Ask+SL*PointK,Ask-TP*PointK,0,Magic,
      0,Red);
      if(ticket<0)Print("Îøèáêà îòêðûòèÿ Buy îðäåðà ", GetLastError());
      }
//----
   return(0);
  }
//+------------------------------------------------------------------+

Profitability Reports

USD/CAD Oct 2024 - Jan 2025
0.00
Total Trades 4
Won Trades 0
Lost trades 4
Win Rate 0.00 %
Expected payoff -34.66
Gross Profit 0.00
Gross Loss -138.63
Total Net Profit -138.63
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
0.00
Total Trades 1
Won Trades 0
Lost trades 1
Win Rate 0.00 %
Expected payoff -53.60
Gross Profit 0.00
Gross Loss -53.60
Total Net Profit -53.60
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
0.56
Total Trades 8
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -19.19
Gross Profit 197.90
Gross Loss -351.40
Total Net Profit -153.50
-100%
-50%
0%
50%
100%
AUD/USD Oct 2024 - Jan 2025
0.00
Total Trades 2
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -52.80
Gross Profit 0.00
Gross Loss -105.60
Total Net Profit 0.00
-100%
-50%
0%
50%
100%

Comments