kolbas_ch_EA

Profit factor:
27814.99

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

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%
GBP/CAD Jul 2025 - Sep 2025
0.97
Total Trades 647
Won Trades 299
Lost trades 348
Win Rate 46.21 %
Expected payoff -0.06
Gross Profit 1094.04
Gross Loss -1132.38
Total Net Profit -38.34
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
0.03
Total Trades 3625
Won Trades 144
Lost trades 3481
Win Rate 3.97 %
Expected payoff -2.75
Gross Profit 346.75
Gross Loss -10309.46
Total Net Profit -9962.71
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
416845.13
Total Trades 2328
Won Trades 2225
Lost trades 103
Win Rate 95.58 %
Expected payoff 82992.80
Gross Profit 193207713.00
Gross Loss -463.50
Total Net Profit 193207249.50
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
1.25
Total Trades 429
Won Trades 274
Lost trades 155
Win Rate 63.87 %
Expected payoff 0.40
Gross Profit 870.50
Gross Loss -697.50
Total Net Profit 173.00
-100%
-50%
0%
50%
100%
USD/JPY Jan 2025 - Jul 2025
2.16
Total Trades 2360
Won Trades 1590
Lost trades 770
Win Rate 67.37 %
Expected payoff 1.13
Gross Profit 4978.59
Gross Loss -2306.91
Total Net Profit 2671.68
-100%
-50%
0%
50%
100%
USD/CHF Jan 2025 - Jul 2025
0.47
Total Trades 1671
Won Trades 810
Lost trades 861
Win Rate 48.47 %
Expected payoff -1.43
Gross Profit 2127.15
Gross Loss -4509.36
Total Net Profit -2382.21
-100%
-50%
0%
50%
100%

Comments