Profit factor:
0.65
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
0 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

NZD/USD Jan 2025 - Jul 2025
1.22
Total Trades 101
Won Trades 40
Lost trades 61
Win Rate 39.60 %
Expected payoff 19.23
Gross Profit 10784.80
Gross Loss -8842.89
Total Net Profit 1941.91
-100%
-50%
0%
50%
100%
GBP/USD Jan 2025 - Jul 2025
0.67
Total Trades 149
Won Trades 47
Lost trades 102
Win Rate 31.54 %
Expected payoff -25.01
Gross Profit 7553.21
Gross Loss -11279.24
Total Net Profit -3726.03
-100%
-50%
0%
50%
100%
GBP/CAD Jan 2025 - Jul 2025
0.31
Total Trades 179
Won Trades 34
Lost trades 145
Win Rate 18.99 %
Expected payoff -40.90
Gross Profit 3300.14
Gross Loss -10621.11
Total Net Profit -7320.97
-100%
-50%
0%
50%
100%
GBP/AUD Jan 2025 - Jul 2025
0.70
Total Trades 181
Won Trades 45
Lost trades 136
Win Rate 24.86 %
Expected payoff -20.03
Gross Profit 8521.54
Gross Loss -12146.97
Total Net Profit -3625.43
-100%
-50%
0%
50%
100%
EUR/USD Jan 2025 - Jul 2025
0.45
Total Trades 135
Won Trades 29
Lost trades 106
Win Rate 21.48 %
Expected payoff -47.61
Gross Profit 5165.63
Gross Loss -11592.77
Total Net Profit -6427.14
-100%
-50%
0%
50%
100%
AUD/USD Jan 2025 - Jul 2025
1.05
Total Trades 109
Won Trades 46
Lost trades 63
Win Rate 42.20 %
Expected payoff 3.61
Gross Profit 8910.38
Gross Loss -8516.47
Total Net Profit 393.91
-100%
-50%
0%
50%
100%
USD/CAD Oct 2024 - Jan 2025
1.36
Total Trades 56
Won Trades 26
Lost trades 30
Win Rate 46.43 %
Expected payoff 20.24
Gross Profit 4271.66
Gross Loss -3138.36
Total Net Profit 1133.30
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
0.41
Total Trades 42
Won Trades 9
Lost trades 33
Win Rate 21.43 %
Expected payoff -60.31
Gross Profit 1790.31
Gross Loss -4323.13
Total Net Profit -2532.82
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
0.51
Total Trades 65
Won Trades 17
Lost trades 48
Win Rate 26.15 %
Expected payoff -42.40
Gross Profit 2921.47
Gross Loss -5677.35
Total Net Profit -2755.88
-100%
-50%
0%
50%
100%
AUD/USD Oct 2024 - Jan 2025
0.42
Total Trades 49
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -48.91
Gross Profit 1762.92
Gross Loss -4159.63
Total Net Profit -2396.71
-100%
-50%
0%
50%
100%

Comments