Profit factor:
0.72
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/CHF Jul 2025 - Sep 2025
0.60
Total Trades 69
Won Trades 20
Lost trades 49
Win Rate 28.99 %
Expected payoff -38.33
Gross Profit 3915.21
Gross Loss -6560.32
Total Net Profit -2645.11
-100%
-50%
0%
50%
100%
USD/CAD Jul 2025 - Sep 2025
0.92
Total Trades 58
Won Trades 21
Lost trades 37
Win Rate 36.21 %
Expected payoff -5.30
Gross Profit 3546.87
Gross Loss -3854.30
Total Net Profit -307.43
-100%
-50%
0%
50%
100%
NZD/USD Jul 2025 - Sep 2025
0.70
Total Trades 46
Won Trades 13
Lost trades 33
Win Rate 28.26 %
Expected payoff -22.62
Gross Profit 2477.30
Gross Loss -3517.92
Total Net Profit -1040.62
-100%
-50%
0%
50%
100%
GBP/USD Jul 2025 - Sep 2025
0.74
Total Trades 90
Won Trades 35
Lost trades 55
Win Rate 38.89 %
Expected payoff -17.43
Gross Profit 4362.85
Gross Loss -5931.89
Total Net Profit -1569.04
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
0.11
Total Trades 114
Won Trades 10
Lost trades 104
Win Rate 8.77 %
Expected payoff -61.30
Gross Profit 897.65
Gross Loss -7886.40
Total Net Profit -6988.75
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
0.65
Total Trades 113
Won Trades 40
Lost trades 73
Win Rate 35.40 %
Expected payoff -18.65
Gross Profit 3958.56
Gross Loss -6066.55
Total Net Profit -2107.99
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
0.91
Total Trades 78
Won Trades 25
Lost trades 53
Win Rate 32.05 %
Expected payoff -7.01
Gross Profit 5527.20
Gross Loss -6073.70
Total Net Profit -546.50
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.82
Total Trades 49
Won Trades 18
Lost trades 31
Win Rate 36.73 %
Expected payoff -12.39
Gross Profit 2704.77
Gross Loss -3311.89
Total Net Profit -607.12
-100%
-50%
0%
50%
100%
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%

Comments