kolbas_ch_EA

Profit factor:
30633.73

This script is designed to automatically place and manage pending and active trades in a trading platform. It works by setting up "buy stop" and "sell stop" orders based on the recent high and low prices of a specific trading instrument (like a currency pair).

Here's the breakdown of what it does, step-by-step:

  1. Setting the Stage (Initial Setup): The script starts by defining some adjustable settings, such as the size of the trades ("Lots"), how far the "trailing stop" should move ("TralUp"), how far away from the high/low price to place orders ("EnterFiltr"), and how far back in time to look for the high and low prices ("InHistory"). It also sets a fixed initial stop loss ("SL").

  2. Finding Highs and Lows: The script identifies the highest high and lowest low price of the trading instrument over a specified historical period. This range is determined by the 'InHistory' variable, allowing the script to consider a certain number of past price bars. The script considers the market spread (difference between buy and sell price) when placing buy orders.

  3. Placing Pending Orders: Based on these highs and lows, it automatically creates two types of pending orders:

    • Buy Stop Order: An order to automatically buy the instrument if the price reaches a level slightly above the recent high (defined using the 'EnterFiltr' variable). This anticipates the price continuing to rise if it breaks through the high.
    • Sell Stop Order: An order to automatically sell the instrument if the price falls to a level slightly below the recent low (defined using the 'EnterFiltr' variable). This anticipates the price continuing to fall if it breaks through the low.
    • The script only uses buy stop and sell stop orders and no buy limit and sell limit orders.
    • The script set's a Stop Loss for both Buy Stop and Sell Stop orders and the stop loss level is defined by the SL variable
  4. Managing Active Trades (Trailing Stop): The script also manages existing buy and sell trades. It checks if the trades are "profitable" (meaning the current price is moving in the desired direction after the trade was opened). If a trade is profitable, it adjusts the "stop loss" level to lock in profits. This is called a "trailing stop." The stop loss is moved closer to the current price as the price moves in a favorable direction. The Trailing stop adjustment is defined by the TralUp variable

  5. Trade Management Logic:

    • The script counts all active Buy and Sell orders with its magic number.
    • The script also counts all active Buy Stop and Sell Stop orders with its magic number.
    • If the script detects any active Buy and Sell orders, it will automatically delete all Buy Stop and Sell Stop orders. This is done to prevent conflicting orders.
    • Finally, the script checks that both the count of active Buy and Sell orders, and the count of active Buy Stop and Sell Stop orders are zero. If both are zero, it means that there are no active trades, and no pending orders, therefore the script places new Buy Stop and Sell Stop orders

In essence, this script aims to automatically enter trades based on price breakouts and manage those trades by using a trailing stop to secure profits as the price moves in a favorable direction.

Orders Execution
It automatically opens orders when conditions are reachedChecks for the total of open ordersIt can change open orders parameters, due to possible stepping strategy
4 Views
0 Downloads
0 Favorites
kolbas_ch_EA
//+------------------------------------------------------------------+
//|                                              kolbas ch by Maloma |
//+------------------------------------------------------------------+

#include <stdlib.mqh>
#include <stderror.mqh>

extern double Lots=0.1;
extern int    TralUp=11;
extern int    EnterFiltr=6;
extern int    InHistory=5;
extern double SL=45;
       int    StopLev;
       int    Tral;
       double MA, MAP;
       double Hich, Loch;
       int    i, CurTot, StopTot;      
        
int OpenOrders()
{
  Hich=High[Highest(Symbol(),NULL,MODE_HIGH,InHistory,0)]+(EnterFiltr+MarketInfo(Symbol(),MODE_SPREAD))*Point;
  Loch=Low[Lowest(Symbol(),NULL,MODE_LOW,InHistory,0)]-EnterFiltr*Point;
  OrderSend(Symbol(),OP_BUYSTOP,Lots,Hich,3,Hich-SL*Point,0,NULL,753,0,CLR_NONE);
  OrderSend(Symbol(),OP_SELLSTOP,Lots,Loch,3,Loch+SL*Point,0,NULL,753,0,CLR_NONE);
//  OrderSend(Symbol(),OP_SELLLIMIT,Lots,Bid+EnterFiltr*Point,3,Ask+2*EnterFiltr*Point,0,NULL,753,0,CLR_NONE);
//  OrderSend(Symbol(),OP_BUYLIMIT,Lots,Ask-EnterFiltr*Point,3,Bid-2*EnterFiltr*Point,0,NULL,753,0,CLR_NONE);
  return(0);
}

int start()
{ 
  StopLev=MarketInfo(Symbol(),MODE_STOPLEVEL);
  Tral=StopLev+TralUp;
  CurTot=0;
  StopTot=0;      
  for (i=0;i<OrdersTotal();i++)
    {
     OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
     if ((Symbol()==OrderSymbol())&&(OrderMagicNumber()==753)&&((OrderType()==OP_BUY)||(OrderType()==OP_SELL)))
       {
        CurTot++;
        if (OrderType()==OP_BUY)
          {
           if ((OrderOpenPrice()+Tral*Point)<Bid)
             {
              if ((OrderStopLoss()+Tral*Point)<Bid) {OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Tral*Point,Bid+Tral*Point,OrderExpiration(),CLR_NONE);}
             }
          }
        if (OrderType()==OP_SELL)
          {
           if (Ask<(OrderOpenPrice()-Tral*Point))
             {
              if (Ask<(OrderStopLoss()-Tral*Point)) {OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Tral*Point,Ask-Tral*Point,OrderExpiration(),CLR_NONE);}
             }
          }
       }
     if ((Symbol()==OrderSymbol())&&(OrderMagicNumber()==753)&&(OrderType()>1)) {StopTot++;}
    }
  for (i=0;i<OrdersTotal();i++)
    {
     OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
     if ((CurTot>0)&&(Symbol()==OrderSymbol())&&(OrderMagicNumber()==753)&&(OrderType()>1)) {OrderDelete(OrderTicket());}
    }  
  if ((CurTot==0)&&(StopTot==0)) {OpenOrders();}
  return(0);
}

Profitability Reports

NZD/USD Jul 2025 - Sep 2025
0.67
Total Trades 737
Won Trades 419
Lost trades 318
Win Rate 56.85 %
Expected payoff -0.63
Gross Profit 964.50
Gross Loss -1431.00
Total Net Profit -466.50
-100%
-50%
0%
50%
100%
GBP/USD Jul 2025 - Sep 2025
1.85
Total Trades 837
Won Trades 589
Lost trades 248
Win Rate 70.37 %
Expected payoff 1.13
Gross Profit 2065.80
Gross Loss -1116.00
Total Net Profit 949.80
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
0.00
Total Trades 3101
Won Trades 1
Lost trades 3100
Win Rate 0.03 %
Expected payoff -3.21
Gross Profit 6.00
Gross Loss -9969.33
Total Net Profit -9963.33
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
0.04
Total Trades 3722
Won Trades 172
Lost trades 3550
Win Rate 4.62 %
Expected payoff -2.68
Gross Profit 435.08
Gross Loss -10399.15
Total Net Profit -9964.07
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
209540.81
Total Trades 2630
Won Trades 2428
Lost trades 202
Win Rate 92.32 %
Expected payoff 72422.70
Gross Profit 190472597.20
Gross Loss -909.00
Total Net Profit 190471688.20
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.89
Total Trades 665
Won Trades 407
Lost trades 258
Win Rate 61.20 %
Expected payoff -0.19
Gross Profit 1032.10
Gross Loss -1161.00
Total Net Profit -128.90
-100%
-50%
0%
50%
100%
USD/JPY Jul 2025 - Sep 2025
3.52
Total Trades 656
Won Trades 483
Lost trades 173
Win Rate 73.63 %
Expected payoff 2.03
Gross Profit 1861.51
Gross Loss -528.49
Total Net Profit 1333.02
-100%
-50%
0%
50%
100%
USD/CHF Jul 2025 - Sep 2025
1.38
Total Trades 450
Won Trades 294
Lost trades 156
Win Rate 65.33 %
Expected payoff 0.74
Gross Profit 1208.59
Gross Loss -876.96
Total Net Profit 331.63
-100%
-50%
0%
50%
100%
USD/CAD Jul 2025 - Sep 2025
1.10
Total Trades 427
Won Trades 258
Lost trades 169
Win Rate 60.42 %
Expected payoff 0.13
Gross Profit 608.82
Gross Loss -552.53
Total Net Profit 56.29
-100%
-50%
0%
50%
100%
NZD/USD Jul 2025 - Sep 2025
0.86
Total Trades 487
Won Trades 288
Lost trades 199
Win Rate 59.14 %
Expected payoff -0.26
Gross Profit 770.20
Gross Loss -895.50
Total Net Profit -125.30
-100%
-50%
0%
50%
100%

Comments