Daydream01_v1

Download script
Profit factor:
139.76

The Daydream trading script is an automated system designed to manage currency pairs by identifying price extremes and reacting to "breakout" movements. It operates by monitoring a specific window of recent market history to determine the boundaries of normal price action, then executes trades when the market pushes outside of those boundaries.

Core Trading Logic

The script functions based on three primary behaviors: identification of price channels, automated trade execution, and dynamic profit protection.

1. Price Boundary Identification The system looks back at a set number of previous candles (the "Channel Period") to establish two key benchmarks: the highest price point reached and the lowest price point reached during that timeframe. These act as the upper and lower limits of the current market "channel."

2. Entry Signals (The Breakout Strategy) The script enters the market based on whether the current price closes outside of these established boundaries:

  • Buy Signal: If the current price drops below the lowest point of the recent channel, the script assumes an oversold condition and opens a "Long" position (buying with the expectation that the price will rise).
  • Sell Signal: If the current price climbs above the highest point of the recent channel, the script assumes an overbought condition and opens a "Short" position (selling with the expectation that the price will fall).

3. Automated Trade Management To ensure the strategy remains organized and efficient, the script includes several automated safety protocols:

  • Opposite Position Handling: If the market creates a signal to buy while a sell position is still open (or vice versa), the script will automatically close the existing trade before opening the new one. This prevents "conflicting" trades from running simultaneously.
  • Time Filtering: The script includes a check to ensure it does not execute multiple orders during the exact same timeframe, preventing repetitive entries on a single price movement.

4. Dynamic Profit Protection (Trailing Stop) One of the most sophisticated features of this script is its "Trailing Profit" mechanism. Rather than simply setting a fixed target and waiting, the script actively follows the market:

  • As the price moves in your favor, the system continuously recalculates the profit target to stay a set distance behind the current price.
  • This allows the trade to stay open as long as the market continues to trend in the desired direction, but it will automatically trigger a closing order if the price reverses even slightly, effectively "locking in" gains during a successful run.
Orders Execution
It automatically opens orders when conditions are reachedChecks for the total of open ordersIt Closes Orders by itself
15 Views
2 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

PERFORMANCE BY SYMBOL

Expected payoff

Average expected payoff across the available backtests for each symbol.

Positive Negative
17 reports
EUR/USD Jul 2025 - Sep 2025
2370.21
Total Trades 389
Won Trades 179
Lost trades 210
Win Rate 46.02 %
Expected payoff 84030.83
Gross Profit 32701789.00
Gross Loss -13797.00
Total Net Profit 32687992.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 2025 - Feb 2026
0.63
Total Trades 218
Won Trades 101
Lost trades 117
Win Rate 46.33 %
Expected payoff -9.77
Gross Profit 3682.00
Gross Loss -5812.00
Total Net Profit -2130.00
-100%
-50%
0%
50%
100%
EUR/USD Oct 2025 - Feb 2026
0.56
Total Trades 601
Won Trades 277
Lost trades 324
Win Rate 46.09 %
Expected payoff -11.11
Gross Profit 8568.00
Gross Loss -15247.00
Total Net Profit -6679.00
-100%
-50%
0%
50%
100%
USD/JPY Jul 2025 - Sep 2025
0.52
Total Trades 381
Won Trades 154
Lost trades 227
Win Rate 40.42 %
Expected payoff -18.95
Gross Profit 7813.07
Gross Loss -15034.60
Total Net Profit -7221.53
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.48
Total Trades 371
Won Trades 175
Lost trades 196
Win Rate 47.17 %
Expected payoff -11.10
Gross Profit 3819.00
Gross Loss -7938.00
Total Net Profit -4119.00
-100%
-50%
0%
50%
100%
USD/CAD Jul 2025 - Sep 2025
0.44
Total Trades 365
Won Trades 120
Lost trades 245
Win Rate 32.88 %
Expected payoff -12.81
Gross Profit 3657.40
Gross Loss -8333.95
Total Net Profit -4676.55
-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%
NZD/USD Jul 2025 - Sep 2025
0.31
Total Trades 367
Won Trades 111
Lost trades 256
Win Rate 30.25 %
Expected payoff -19.29
Gross Profit 3193.00
Gross Loss -10272.00
Total Net Profit -7079.00
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
0.30
Total Trades 321
Won Trades 97
Lost trades 224
Win Rate 30.22 %
Expected payoff -29.99
Gross Profit 4053.90
Gross Loss -13679.21
Total Net Profit -9625.31
-100%
-50%
0%
50%
100%
GBP/USD Jul 2025 - Sep 2025
0.28
Total Trades 274
Won Trades 80
Lost trades 194
Win Rate 29.20 %
Expected payoff -35.13
Gross Profit 3740.00
Gross Loss -13366.00
Total Net Profit -9626.00
-100%
-50%
0%
50%
100%
USD/CHF Jul 2025 - Sep 2025
0.28
Total Trades 318
Won Trades 97
Lost trades 221
Win Rate 30.50 %
Expected payoff -29.88
Gross Profit 3717.50
Gross Loss -13218.15
Total Net Profit -9500.65
-100%
-50%
0%
50%
100%
GBP/AUD Oct 2025 - Feb 2026
0.28
Total Trades 194
Won Trades 55
Lost trades 139
Win Rate 28.35 %
Expected payoff -47.42
Gross Profit 3665.74
Gross Loss -12865.82
Total Net Profit -9200.08
-100%
-50%
0%
50%
100%
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/CAD Oct 2025 - Feb 2026
0.10
Total Trades 192
Won Trades 38
Lost trades 154
Win Rate 19.79 %
Expected payoff -50.13
Gross Profit 1095.41
Gross Loss -10720.53
Total Net Profit -9625.12
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
0.02
Total Trades 89
Won Trades 6
Lost trades 83
Win Rate 6.74 %
Expected payoff -103.38
Gross Profit 178.56
Gross Loss -9379.05
Total Net Profit -9200.49
-100%
-50%
0%
50%
100%

Comments