Daydream01_v1

Profit factor:
0.37
Orders Execution
It automatically opens orders when conditions are reachedChecks for the total of open ordersIt Closes Orders by itself
0 Views
0 Downloads
0 Favorites
Daydream01_v1
//+------------------------------------------------------------------+
//|                                              Daydream by Cothool |
//|                                          Recommended: USD/JPY 1H |
//+------------------------------------------------------------------+
#define MAGIC_NUM  48213657
//----
extern double Lots      =1;
extern int ChannelPeriod=25;
extern int Slippage     =3;
extern int TakeProfit   =15;
//----
double LastOrderTime=0;
double CurrentDirection=0;
double CurrentTakeProfitPrice=0;
//----
void OpenLong()
  {
   if (Time[0]==LastOrderTime)
      return;
   if (CurrentDirection!=0)
      return;
//----
   OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage, 0, 0,
             "Daydream", MAGIC_NUM, 0, Blue);
   LastOrderTime=Time[0];
   CurrentDirection=1;
  }
//----
void OpenShort()
  {
   if (Time[0]==LastOrderTime)
      return;
   if (CurrentDirection!=0)
      return;
//----
   OrderSend(Symbol(), OP_SELL, Lots, Bid, Slippage, 0, 0,
             "Daydream", MAGIC_NUM, 0, Red);
   LastOrderTime=Time[0];
   CurrentDirection=-1;
  }
//----
void CloseLong()
  {
   int i;

   if (Time[0]==LastOrderTime)
      return;
   if (CurrentDirection!=1)
      return;
//----
   for(i=0; i < OrdersTotal(); i++)
     {
      if (OrderSelect(i, SELECT_BY_POS) && OrderSymbol()==Symbol() &&
          OrderMagicNumber()==MAGIC_NUM && OrderType()==OP_BUY)
        {
         OrderClose(OrderTicket(), OrderLots(), Bid, 3, White);
         LastOrderTime=Time[0];
         CurrentDirection=0;
        }
     }
  }
//----
void CloseShort()
  {
   int i;
//----
   if (Time[0]==LastOrderTime)
      return;
   if (CurrentDirection!=-1)
      return;
   for(i=0; i < OrdersTotal(); i++)
     {
      if (OrderSelect(i, SELECT_BY_POS) && OrderSymbol()==Symbol() &&
          OrderMagicNumber()==MAGIC_NUM && OrderType()==OP_SELL)
        {
         OrderClose(OrderTicket(), OrderLots(), Ask, 3, White);
         LastOrderTime=Time[0];
         CurrentDirection=0;
        }
     }
  }
//----
void start()
  {
   double HighestValue;
   double LowestValue;
   //
   HighestValue=High[Highest(NULL, 0, MODE_HIGH, ChannelPeriod, 1)];
   LowestValue=Low[Lowest(NULL, 0, MODE_LOW, ChannelPeriod, 1)];
   // BUY
   if (Close[0] < LowestValue)
     {
      CloseShort();
      OpenLong();
      CurrentTakeProfitPrice=Bid + TakeProfit * Point;
     }
   // SELL
   if (Close[0] > HighestValue)
     {
      CloseLong();
      OpenShort();
      CurrentTakeProfitPrice=Ask - TakeProfit * Point;
     }
   // Trailing Profit Taking for Long Position
   if (CurrentDirection==1)
     {
      if (CurrentTakeProfitPrice > Bid + TakeProfit * Point)
         CurrentTakeProfitPrice=Bid + TakeProfit * Point;
      if (Bid>=CurrentTakeProfitPrice)
         CloseLong();
     }
   // Trailing Profit Taking for Short Position
   if (CurrentDirection==-1)
     {
      if (CurrentTakeProfitPrice < Ask - TakeProfit * Point)
         CurrentTakeProfitPrice=Ask - TakeProfit * Point;
      if (Ask<=CurrentTakeProfitPrice)
         CloseShort();
     }
  }
//+------------------------------------------------------------------+

Profitability Reports

USD/CAD Oct 2024 - Jan 2025
0.27
Total Trades 199
Won Trades 52
Lost trades 147
Win Rate 26.13 %
Expected payoff -34.92
Gross Profit 2596.56
Gross Loss -9545.20
Total Net Profit -6948.64
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
0.17
Total Trades 208
Won Trades 50
Lost trades 158
Win Rate 24.04 %
Expected payoff -42.14
Gross Profit 1829.00
Gross Loss -10594.00
Total Net Profit -8765.00
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
0.67
Total Trades 188
Won Trades 93
Lost trades 95
Win Rate 49.47 %
Expected payoff -17.84
Gross Profit 6884.00
Gross Loss -10237.00
Total Net Profit -3353.00
-100%
-50%
0%
50%
100%
AUD/USD Oct 2024 - Jan 2025
0.38
Total Trades 197
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -29.28
Gross Profit 3496.00
Gross Loss -9265.00
Total Net Profit 0.00
-100%
-50%
0%
50%
100%

Comments