Profit factor:
0.73
Orders Execution
Checks for the total of open ordersIt Closes Orders by itself It automatically opens orders when conditions are reachedIt can change open orders parameters, due to possible stepping strategy
3 Views
0 Downloads
0 Favorites
NOC-EA
extern double dBuyLevel = 0.54;
extern double dSellLevel= 0.74;
extern double dStopLoss = 200;
extern double dTrailingStop = 174;

// ------

double dTakeProfit = 0;

datetime timePrev = 0;
int nBars;
int nSlip = 5;

extern double risk = 0.05;

int nMagic = 0;


// ------

int init ()
{
    nBars = Bars;

    
    return(0);
}
// ------
int deinit()
{
    return(0);
}

// ------

int start()
{
    if(Bars < 200)
        return(0);
    
    if(!IsBarEnd())
        return(0);
    
    // ------
    
    double dNoc = iCustom(NULL, 0, "_NOC", 0, 3);
    double dNocPrev = iCustom(NULL, 0, "_NOC", 0, 4);
        
    for(int nCnt = OrdersTotal() - 1; nCnt >= 0; nCnt--)
    {
        OrderSelect(nCnt, SELECT_BY_POS, MODE_TRADES);
        if(OrderMagicNumber() == nMagic)
        {
            if(OrderType() == OP_BUY)
            {         
                if(dNocPrev >= dSellLevel && dNoc <= dSellLevel)
                {
                    OrderClose(OrderTicket(), 
                        OrderLots(), Bid, nSlip, Aqua);
                    break;
                }
            }
            else if(OrderType() == OP_SELL)
            {
                if(dNocPrev <= dBuyLevel && dNoc >= dBuyLevel)
                {
                    OrderClose(OrderTicket(), 
                        OrderLots(), Ask, nSlip, OrangeRed);
                    break;
                }
            }
        }
    }

    int nNumOfOpenedOrders = 0;
    for(nCnt = OrdersTotal() - 1; nCnt >= 0; nCnt--)
    {
        OrderSelect(nCnt, SELECT_BY_POS, MODE_TRADES);
        if(OrderMagicNumber() == nMagic)
            nNumOfOpenedOrders++;
    }

    if(nNumOfOpenedOrders == 0)
    {
        if(dNocPrev <= dBuyLevel && dNoc >= dBuyLevel) 
        {
            OrderSend(Symbol(), OP_BUY,  GetRisk(risk), Ask, 
                nSlip, Ask - dStopLoss*Point, 0, "", 
                nMagic, 0, Aqua);
        }
        else if(dNocPrev >= dSellLevel && dNoc <= dSellLevel) 
        {
            OrderSend(Symbol(), OP_SELL, GetRisk(risk), Bid, 
                nSlip, Bid + dStopLoss*Point, 0, "", 
                nMagic, 0, OrangeRed);
        }
    }
        
    // ------

    ModifyOrders();
    
    // ------
    
    return(0);
}


// ------

void ModifyOrders()
{
    for(int nCnt = 0; nCnt < OrdersTotal(); nCnt++)
    {
        OrderSelect(nCnt, SELECT_BY_POS, MODE_TRADES);
        if(OrderMagicNumber() == nMagic)
        {
            if(OrderType() == OP_BUY)
            {
                if(OrderStopLoss() < Bid - dTrailingStop*Point - 5 * Point)
                {
                    OrderModify(OrderTicket(), OrderOpenPrice(), 
                        Bid - dTrailingStop*Point, OrderTakeProfit(), 0, Aqua);
                    break;
                }
            }
            
            if(OrderType() == OP_SELL)
            {
                if(OrderStopLoss() > Ask + dTrailingStop*Point + 5 * Point)
                {
                    OrderModify(OrderTicket(), OrderOpenPrice(), 
                        Ask + dTrailingStop*Point, OrderTakeProfit(), 
                        0, OrangeRed);
                    break;
                }
            }
        }
    }
}

// ------

bool IsBarEnd()
{
    bool bIsBarEnd = false;
    if(nBars != Bars)
    {
        bIsBarEnd = true;
        nBars = Bars;
    }
    
    return(bIsBarEnd);
}

double GetRisk( double dRisk)
{
   
   double   dMinLot = MarketInfo (Symbol (),MODE_MINLOT);
   double   dMaxLot = MarketInfo (Symbol (),MODE_MAXLOT);
   double   dLotStep = MarketInfo (Symbol (),MODE_LOTSTEP);
   double   dLotSize = MarketInfo (Symbol (),MODE_LOTSIZE);
   double   dLots;

   if (dMinLot < 0 || dMaxLot <= 0.0 || dLotStep <= 0.0)
   {
      Print ("CalculateVolume: invalid MarketInfo() results [",dMinLot,",",dMaxLot,",",dLotStep,"]");
      return (0);
   }

   if (AccountLeverage () <= 0)
   {
      Print ("CalculateVolume: invalid AccountLeverage() [",AccountLeverage (),"]");
      return (0);
   }

   dLots = NormalizeDouble (AccountBalance () * dRisk * AccountLeverage () / dLotSize,2);
   dLots = NormalizeDouble (dLots / dLotStep,0) * dLotStep;
   if (dLots < dMinLot) dLots = dMinLot;
   if (dLots > dMaxLot) dLots = dMaxLot;
   return (dLots);
}


Profitability Reports

USD/JPY Jul 2025 - Sep 2025
1.58
Total Trades 106
Won Trades 43
Lost trades 63
Win Rate 40.57 %
Expected payoff 43.92
Gross Profit 12642.53
Gross Loss -7987.31
Total Net Profit 4655.22
-100%
-50%
0%
50%
100%
USD/CHF Jul 2025 - Sep 2025
0.50
Total Trades 46
Won Trades 16
Lost trades 30
Win Rate 34.78 %
Expected payoff -47.46
Gross Profit 2213.80
Gross Loss -4397.17
Total Net Profit -2183.37
-100%
-50%
0%
50%
100%
USD/CAD Jul 2025 - Sep 2025
1.31
Total Trades 46
Won Trades 17
Lost trades 29
Win Rate 36.96 %
Expected payoff 17.48
Gross Profit 3423.30
Gross Loss -2619.28
Total Net Profit 804.02
-100%
-50%
0%
50%
100%
NZD/USD Jul 2025 - Sep 2025
0.61
Total Trades 35
Won Trades 8
Lost trades 27
Win Rate 22.86 %
Expected payoff -34.07
Gross Profit 1879.29
Gross Loss -3071.59
Total Net Profit -1192.30
-100%
-50%
0%
50%
100%
GBP/USD Jul 2025 - Sep 2025
0.52
Total Trades 52
Won Trades 17
Lost trades 35
Win Rate 32.69 %
Expected payoff -35.30
Gross Profit 2013.73
Gross Loss -3849.42
Total Net Profit -1835.69
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
0.32
Total Trades 64
Won Trades 14
Lost trades 50
Win Rate 21.88 %
Expected payoff -47.23
Gross Profit 1397.95
Gross Loss -4420.66
Total Net Profit -3022.71
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
0.52
Total Trades 69
Won Trades 23
Lost trades 46
Win Rate 33.33 %
Expected payoff -30.14
Gross Profit 2230.84
Gross Loss -4310.56
Total Net Profit -2079.72
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
0.70
Total Trades 53
Won Trades 18
Lost trades 35
Win Rate 33.96 %
Expected payoff -27.09
Gross Profit 3326.77
Gross Loss -4762.33
Total Net Profit -1435.56
-100%
-50%
0%
50%
100%
USD/JPY Jan 2025 - Jul 2025
1.17
Total Trades 206
Won Trades 78
Lost trades 128
Win Rate 37.86 %
Expected payoff 11.26
Gross Profit 15953.96
Gross Loss -13633.67
Total Net Profit 2320.29
-100%
-50%
0%
50%
100%
USD/CHF Jan 2025 - Jul 2025
0.63
Total Trades 120
Won Trades 42
Lost trades 78
Win Rate 35.00 %
Expected payoff -29.88
Gross Profit 5979.04
Gross Loss -9564.91
Total Net Profit -3585.87
-100%
-50%
0%
50%
100%

Comments