Starter_CoolGluk

Author: Copyright � 2005, MetaQuotes Software Corp.
Profit factor:
6.40

Technical Logic Overview: Starter Script

This document provides a non-technical explanation of the logic contained within the provided MetaTrader script. The script is an automated trading system (Expert Advisor) designed to manage trades based on specific technical indicators, risk management rules, and historical performance analysis.

1. Core Trading Philosophy

The script operates on a "signal-based" strategy. It monitors three specific mathematical indicators to determine market direction and then executes trades automatically when certain conditions align. It also includes a dynamic "Position Sizing" logic that adjusts the amount of money invested based on past successes and failures.

2. Key Components and Indicators

The script uses three primary tools to "read" the market:

  • Laguerre Oscillator: Used primarily to identify the current momentum and trend direction.
  • Moving Average (MA): A smoothed average of price over a set period (default is 120) used to determine the general trajectory of the market (upward or downward).
  • CCI (Commodity Channel Index): Used to measure the strength of price movement relative to its historical average, helping to identify "overbought" or "oversold" conditions.

3. Entry Logic (How it opens trades)

The script will only open a new trade if there are no existing positions currently open for the specific currency pair. It looks for two distinct scenarios:

Buy Orders (Long Positions)

A purchase is triggered when all four of these conditions are met simultaneously:

  1. Laguerre Indicator: Is at or below zero (suggesting a potential bottom or reversal).
  2. Moving Average: The current value is higher than the previous value (indicating an upward trend).
  3. CCI Indicator: Is below -5 (indicating the market might be "oversold").
  4. Availability: No other "Sell" positions are currently active.

Sell Orders (Short Positions)

A sale is triggered when all four of these conditions are met simultaneously:

  1. Laguerre Indicator: Is at or above 1 (suggesting a potential peak or reversal).
  2. Moving Average: The current value is lower than the previous value (indicating a downward trend).
  3. CCI Indicator: Is above 5 (indicating the market might be "overbought").
  4. Availability: No other "Buy" positions are currently active.

4. Exit Logic (How it closes trades)

The script monitors active trades constantly and will close them based on two main triggers:

Momentum Reversal

  • For Buy Positions: If the Laguerre indicator rises above 0.9, the script assumes the upward momentum is exhausted and closes the trade.
  • For Sell Positions: If the Laguerre indicator falls below 0.1, the script assumes the downward momentum is exhausted and closes the trade.

Stop Loss (Risk Protection)

The script includes a safety feature where a trade will be automatically closed if the price moves against the position by a predefined number of points (the Stop variable). This acts as a "circuit breaker" to prevent significant losses in a single trade.

5. Intelligent Risk Management

A standout feature of this script is its Dynamic Lot Calculation. Instead of always trading the same amount, it analyzes your trading history:

  • Risk Awareness: It calculates the lot size based on a percentage of your "Free Margin" (available funds).
  • Loss Correction: If the script detects a string of recent losses without a break, it automatically reduces the trade size to preserve capital.
  • Success Adjustment: If the script detects a string of wins, it can adjust the lot size accordingly based on the IncreaseFactor.
  • Minimum Safety: The script ensures that even after reductions, the trade size never falls below a minimum of 0.1 lots to ensure the account remains active.
Orders Execution
Checks for the total of open ordersIt automatically opens orders when conditions are reachedIt Closes Orders by itself
Indicators Used
Commodity channel indexMoving average indicator
18 Views
2 Downloads
0 Favorites
Starter_CoolGluk
//+------------------------------------------------------------------+
//|                                                      Starter.mq4 |
//|                      Copyright © 2005, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"
#define MAGICMA  20050610

extern double Lots               = 1;
extern double MaximumRisk        = 0.03;
extern double DecreaseFactor     = 3;
extern double IncreaseFactor     = 3;
//extern double Lots = 4;
extern double Stop = 10;
extern double MAPeriod=120;
double spread=1.5;
//+-- extern double JuiceLevel = 0.0005;

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//---- 
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 
   
//----
   return(0);
  }
 
//+------------------------------------------------------------------+
//| Calculate optimal lot size                                       |
//+------------------------------------------------------------------+
double LotsOptimized()
  {
   double lot=Lots;
   int    orders=HistoryTotal();     // history orders total
   int    losses=0;                  // number of losses orders without a break
   int    wines=0;                  // number of wines orders without a break
   int    i;
//---- select lot size
   lot=NormalizeDouble(AccountFreeMargin()*MaximumRisk/1000,1);
//---- calcuulate number of losses orders without a break
   if(DecreaseFactor>0)
     {
      for(i=orders-1;i>=0;i--)
        {
         if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==false) { Print("Error in history!"); break; }
         if(OrderSymbol()!=Symbol() || OrderType()>OP_SELL) continue;
         //----
         if(OrderProfit()>0) break;
         if(OrderProfit()<0) losses++;
        }
      if(losses>1) lot=NormalizeDouble(lot-lot*losses/DecreaseFactor,1);
     }
   if((IncreaseFactor>0) && (losses<1))
     {
      for(i=orders-1;i>=0;i--)
        {
         if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==false) { Print("Error in history!"); break; }
         if(OrderSymbol()!=Symbol() || OrderType()>OP_SELL) continue;
         //----
         if(OrderProfit()<0) break;
         if(OrderProfit()>0) wines++;
        }
      if(wines>1) lot=NormalizeDouble(lot-lot*wines/IncreaseFactor,1);
     }
//---- return lot size
   if(lot<0.1) lot=0.1;
//   lot=1;
   return(lot);
  }  
  
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
   double Laguerre;
   double Alpha;
   double MA, MAprevious;
   
//+--   double Juice;
   int cnt, ticket, total;
  
  Laguerre=iCustom(NULL, 0, "Laguerre", 0, 0);
  Alpha=iCCI(NULL, 0, 14, PRICE_CLOSE, 0);
  MA=iMA(NULL,0,MAPeriod,0,MODE_EMA,PRICE_MEDIAN,0);
  MAprevious=iMA(NULL,0,MAPeriod,0,MODE_EMA,PRICE_MEDIAN,1);
//+--  Juice=iCustom(NULL,0,"Juice",0,0);

   total=OrdersTotal();  
   bool est_s=true;
   bool est_b=true;
   for(cnt=0;cnt<total;cnt++)
     {
       OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
       if((OrderType()==OP_SELL) && (OrderSymbol()==Symbol())) est_s=false;
       if((OrderType()==OP_BUY) && (OrderSymbol()==Symbol())) est_b=false;
     }
//   if(total<1) 
     {
      // no opened orders identified
      if(AccountFreeMargin()<(1000*Lots))
        {
         Print("We have no money. Free Margin = ", AccountFreeMargin());
         return(0);  
        }
      // check for long position (BUY) possibility
      if((Laguerre<=0) && (MA>MAprevious) && (Alpha<-5) && est_b) //+-- && Juice>JuiceLevel)
        {
        ticket=OrderSend(Symbol(),OP_BUY,LotsOptimized(),Ask,3,0,0,"starter",16384,0,Green);
        }
      // check for short position (SELL) possibility
      if((Laguerre>=1) && (MA<MAprevious) && (Alpha>5) && est_s) //+-- && Juice>JuiceLevel)
        {
         ticket=OrderSend(Symbol(),OP_SELL,LotsOptimized(),Bid,3,0,0,"starter",16384,0,Red);
        } 
     }
// it is important to enter the market correctly, 
   // but it is more important to exit it correctly...   
   for(cnt=0;cnt<total;cnt++)
     {
      OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
      if(OrderType()<=OP_SELL &&   // check for opened position 
         OrderSymbol()==Symbol())  // check for symbol
        {
         if(OrderType()==OP_BUY)   // long position is opened
           {
            // should it be closed?
            if(Laguerre>0.9)
                {
                 OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet); // close position
                 return(0); // exit
                }
            // check for stop
            if(Stop>0)  
              {                 
               if(Bid-OrderOpenPrice()>Point*Stop)
                 {
                   OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet); // close position
                   return(0);
                 }
              }
           }
         else // go to short position
           {
            // should it be closed?
            if(Laguerre<0.1)
              {
               OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet); // close position
               return(0); // exit
              }
            // check for stop
            if(Stop>0)  
              {                 
               if(OrderOpenPrice()-Ask>Point*Stop)
                 {
                   OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet); // close position
                   return(0);
                 }
              }
           }
        }
     }
     
   return(0);
  }
// the end.

Profitability Reports

EUR/USD Jan 2025 - Jul 2025
201.41
Total Trades 620
Won Trades 592
Lost trades 28
Win Rate 95.48 %
Expected payoff 16335.23
Gross Profit 10178378.00
Gross Loss -50535.30
Total Net Profit 10127842.70
-100%
-50%
0%
50%
100%
AUD/USD Oct 2024 - Jan 2025
1.21
Total Trades 199
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff 0.22
Gross Profit 244.20
Gross Loss -201.00
Total Net Profit 43.20
-100%
-50%
0%
50%
100%
USD/CAD Jul 2025 - Sep 2025
0.89
Total Trades 113
Won Trades 107
Lost trades 6
Win Rate 94.69 %
Expected payoff -0.13
Gross Profit 118.11
Gross Loss -132.50
Total Net Profit -14.39
-100%
-50%
0%
50%
100%
USD/CHF Jan 2025 - Jul 2025
0.59
Total Trades 348
Won Trades 323
Lost trades 25
Win Rate 92.82 %
Expected payoff -1.41
Gross Profit 701.23
Gross Loss -1190.45
Total Net Profit -489.22
-100%
-50%
0%
50%
100%
EUR/USD Oct 2025 - Feb 2026
0.56
Total Trades 390
Won Trades 353
Lost trades 37
Win Rate 90.51 %
Expected payoff -1.01
Gross Profit 496.80
Gross Loss -889.50
Total Net Profit -392.70
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
0.54
Total Trades 114
Won Trades 103
Lost trades 11
Win Rate 90.35 %
Expected payoff -1.25
Gross Profit 164.70
Gross Loss -307.30
Total Net Profit -142.60
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
0.49
Total Trades 225
Won Trades 216
Lost trades 9
Win Rate 96.00 %
Expected payoff -1.32
Gross Profit 288.40
Gross Loss -585.70
Total Net Profit -297.30
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.46
Total Trades 198
Won Trades 176
Lost trades 22
Win Rate 88.89 %
Expected payoff -1.50
Gross Profit 257.70
Gross Loss -554.40
Total Net Profit -296.70
-100%
-50%
0%
50%
100%
USD/CAD Jul 2025 - Sep 2025
0.39
Total Trades 192
Won Trades 172
Lost trades 20
Win Rate 89.58 %
Expected payoff -1.57
Gross Profit 194.33
Gross Loss -494.95
Total Net Profit -300.62
-100%
-50%
0%
50%
100%
USD/JPY Jul 2025 - Sep 2025
0.33
Total Trades 297
Won Trades 277
Lost trades 20
Win Rate 93.27 %
Expected payoff -1.72
Gross Profit 257.08
Gross Loss -768.34
Total Net Profit -511.26
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.31
Total Trades 108
Won Trades 94
Lost trades 14
Win Rate 87.04 %
Expected payoff -3.11
Gross Profit 153.80
Gross Loss -489.50
Total Net Profit -335.70
-100%
-50%
0%
50%
100%
USD/CHF Jul 2025 - Sep 2025
0.30
Total Trades 173
Won Trades 144
Lost trades 29
Win Rate 83.24 %
Expected payoff -5.17
Gross Profit 385.86
Gross Loss -1279.50
Total Net Profit -893.64
-100%
-50%
0%
50%
100%
GBP/CAD Jan 2025 - Jul 2025
0.28
Total Trades 481
Won Trades 454
Lost trades 27
Win Rate 94.39 %
Expected payoff -2.62
Gross Profit 483.12
Gross Loss -1742.44
Total Net Profit -1259.32
-100%
-50%
0%
50%
100%
GBP/USD Jul 2025 - Sep 2025
0.28
Total Trades 219
Won Trades 197
Lost trades 22
Win Rate 89.95 %
Expected payoff -3.69
Gross Profit 307.20
Gross Loss -1114.90
Total Net Profit -807.70
-100%
-50%
0%
50%
100%
AUD/USD Oct 2025 - Feb 2026
0.28
Total Trades 220
Won Trades 170
Lost trades 50
Win Rate 77.27 %
Expected payoff -4.26
Gross Profit 362.80
Gross Loss -1299.40
Total Net Profit -936.60
-100%
-50%
0%
50%
100%
NZD/USD Jan 2025 - Jul 2025
0.25
Total Trades 304
Won Trades 276
Lost trades 28
Win Rate 90.79 %
Expected payoff -4.01
Gross Profit 402.10
Gross Loss -1621.00
Total Net Profit -1218.90
-100%
-50%
0%
50%
100%
USD/CAD Jan 2025 - Jul 2025
0.25
Total Trades 415
Won Trades 388
Lost trades 27
Win Rate 93.49 %
Expected payoff -2.63
Gross Profit 366.42
Gross Loss -1459.51
Total Net Profit -1093.09
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
0.25
Total Trades 144
Won Trades 131
Lost trades 13
Win Rate 90.97 %
Expected payoff -3.36
Gross Profit 160.26
Gross Loss -644.44
Total Net Profit -484.18
-100%
-50%
0%
50%
100%
USD/JPY Jul 2025 - Sep 2025
0.24
Total Trades 190
Won Trades 176
Lost trades 14
Win Rate 92.63 %
Expected payoff -2.89
Gross Profit 170.55
Gross Loss -719.69
Total Net Profit -549.14
-100%
-50%
0%
50%
100%
USD/JPY Jan 2025 - Jul 2025
0.22
Total Trades 580
Won Trades 546
Lost trades 34
Win Rate 94.14 %
Expected payoff -3.81
Gross Profit 629.69
Gross Loss -2839.51
Total Net Profit -2209.82
-100%
-50%
0%
50%
100%
USD/CAD Oct 2024 - Jan 2025
0.21
Total Trades 113
Won Trades 100
Lost trades 13
Win Rate 88.50 %
Expected payoff -3.48
Gross Profit 106.38
Gross Loss -500.05
Total Net Profit -393.67
-100%
-50%
0%
50%
100%
GBP/AUD Jan 2025 - Jul 2025
0.21
Total Trades 395
Won Trades 374
Lost trades 21
Win Rate 94.68 %
Expected payoff -3.54
Gross Profit 366.32
Gross Loss -1763.26
Total Net Profit -1396.94
-100%
-50%
0%
50%
100%
NZD/USD Jul 2025 - Sep 2025
0.21
Total Trades 160
Won Trades 126
Lost trades 34
Win Rate 78.75 %
Expected payoff -5.89
Gross Profit 253.10
Gross Loss -1196.30
Total Net Profit -943.20
-100%
-50%
0%
50%
100%
USD/CHF Jul 2025 - Sep 2025
0.18
Total Trades 111
Won Trades 94
Lost trades 17
Win Rate 84.68 %
Expected payoff -8.57
Gross Profit 210.68
Gross Loss -1161.78
Total Net Profit -951.10
-100%
-50%
0%
50%
100%
GBP/USD Jan 2025 - Jul 2025
0.17
Total Trades 350
Won Trades 321
Lost trades 29
Win Rate 91.71 %
Expected payoff -6.30
Gross Profit 446.80
Gross Loss -2652.90
Total Net Profit -2206.10
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
0.17
Total Trades 121
Won Trades 109
Lost trades 12
Win Rate 90.08 %
Expected payoff -5.33
Gross Profit 131.53
Gross Loss -775.93
Total Net Profit -644.40
-100%
-50%
0%
50%
100%
GBP/AUD Oct 2025 - Feb 2026
0.16
Total Trades 335
Won Trades 287
Lost trades 48
Win Rate 85.67 %
Expected payoff -6.00
Gross Profit 393.95
Gross Loss -2403.35
Total Net Profit -2009.40
-100%
-50%
0%
50%
100%
NZD/USD Jul 2025 - Sep 2025
0.15
Total Trades 73
Won Trades 55
Lost trades 18
Win Rate 75.34 %
Expected payoff -8.67
Gross Profit 108.70
Gross Loss -741.70
Total Net Profit -633.00
-100%
-50%
0%
50%
100%
AUD/USD Jan 2025 - Jul 2025
0.12
Total Trades 225
Won Trades 190
Lost trades 35
Win Rate 84.44 %
Expected payoff -8.80
Gross Profit 280.40
Gross Loss -2261.20
Total Net Profit -1980.80
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
0.05
Total Trades 112
Won Trades 65
Lost trades 47
Win Rate 58.04 %
Expected payoff -16.06
Gross Profit 102.79
Gross Loss -1901.83
Total Net Profit -1799.04
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
0.04
Total Trades 119
Won Trades 56
Lost trades 63
Win Rate 47.06 %
Expected payoff -21.56
Gross Profit 100.09
Gross Loss -2665.45
Total Net Profit -2565.36
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
0.00
Total Trades 35
Won Trades 32
Lost trades 3
Win Rate 91.43 %
Expected payoff -3014.60
Gross Profit 47.00
Gross Loss -105558.00
Total Net Profit -105511.00
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
0.00
Total Trades 30
Won Trades 25
Lost trades 5
Win Rate 83.33 %
Expected payoff -3516.81
Gross Profit 47.50
Gross Loss -105551.80
Total Net Profit -105504.30
-100%
-50%
0%
50%
100%

Comments