Profit factor:
0.40
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 strategyChecks for the total of closed orders
Miscellaneous
It issuies visual alerts to the screen
6 Views
0 Downloads
0 Favorites
NLMAExp
//+------------------------------------------------------------------+
//|                                                      NLMAExp.mq4 |
//|                                             http://liteforex.net |
//|                                                              Alf |
//+------------------------------------------------------------------+
#property copyright "http://liteforex.net"
#property link      "Alf"

//---- input parameters
extern int       ST=50;
extern int       TP=100;
extern int       STEP=30; // øàã äëÿ òðåëèíãñòîïà
double    Lot=0.1;
extern int     Price          = 0;
extern int     Length         = 9;
extern int     Displace       = 0;
extern int     Filter         = 0;
extern double  Deviation      = 0; 
extern double    MinLot=0.1;
extern double    MaxLot=5;
extern double    K=1.68;// êîýôèöìåíò èçìåíåíèÿ ëîòà, 1 ëîò íåèçìåíÿåòñÿ 2 óäâîåíèå 3 óòðîåíèå è ò.ä.

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
   lot();
   Comment("Lot=",Lot);
   
   if(OrdersTotal()==1)
   {
      OrderSelect(0,SELECT_BY_POS,MODE_TRADES);
      if(OrderType()==OP_BUY && sell()) {OrderClose(OrderTicket(),OrderLots(),Bid,3);OrderSend(Symbol(),OP_SELL,Lot,Bid,3,Ask+ST*Point,Bid-TP*Point);Alert("Sell");return(0);}
      if(OrderType()==OP_SELL && buy()) {OrderClose(OrderTicket(),OrderLots(),Ask,3);OrderSend(Symbol(),OP_BUY,Lot,Ask,3,Bid-ST*Point,Ask+TP*Point);Alert("Buy");return(0);}
      if(OrderType()==OP_BUY)
         if(OrderStopLoss()+ST*Point+STEP*Point<Bid) OrderModify(OrderTicket(),OrderOpenPrice(),Bid-ST*Point,OrderTakeProfit(),0);
      if(OrderType()==OP_SELL)
         if(OrderStopLoss()-ST*Point-STEP*Point>Ask)OrderModify(OrderTicket(),OrderOpenPrice(),Ask+ST*Point,OrderTakeProfit(),0);
   }
   
   if(OrdersTotal()==0)
   {
      
      if(buy()){OrderSend(Symbol(),OP_BUY,Lot,Ask,3,Bid-ST*Point,Ask+TP*Point);Alert("Buy");return(0);}
      if(sell()){OrderSend(Symbol(),OP_SELL,Lot,Bid,3,Ask+ST*Point,Bid-TP*Point);Alert("Sell");}
   }
//----
   return(0);
  }
//+------------------------------------------------------------------+

bool buy()
{
   if(iCustom(Symbol(),0,"NonLagMA",Price,Length,Displace,Filter,1,1,Deviation,false,0,0)>iCustom(Symbol(),0,"NonLagMA",Price,Length,Displace,Filter,1,1,Deviation,false,0,1) && iCustom(Symbol(),0,"NonLagMA",Price,Length,Displace,Filter,1,1,Deviation,false,0,1)<iCustom(Symbol(),0,"NonLagMA",Price,Length,Displace,Filter,1,1,Deviation,false,0,2))return(true);
   return(false); 
}

bool sell()
{
      if(iCustom(Symbol(),0,"NonLagMA",Price,Length,Displace,Filter,1,1,Deviation,false,0,0)<iCustom(Symbol(),0,"NonLagMA",Price,Length,Displace,Filter,1,1,Deviation,false,0,1) && iCustom(Symbol(),0,"NonLagMA",Price,Length,Displace,Filter,1,1,Deviation,false,0,1)>iCustom(Symbol(),0,"NonLagMA",Price,Length,Displace,Filter,1,1,Deviation,false,0,2))return(true);
   return(false); 
}

void lot()
{
   if(OrdersHistoryTotal()==0) {Lot=MinLot;return;}
   OrderSelect(OrdersHistoryTotal()-1,SELECT_BY_POS,MODE_HISTORY);
   if(OrderProfit()>0) {Lot=MinLot;return;}
   Lot=OrderLots()*K;
   if(MinLot<1) Lot=MathRound(Lot*10)/10;
   else Lot=MathRound(Lot);
   if(Lot<MinLot)Lot=MinLot;
   if(Lot>MaxLot)Lot=MaxLot;
}

Profitability Reports

USD/CHF Jul 2025 - Sep 2025
0.43
Total Trades 361
Won Trades 95
Lost trades 266
Win Rate 26.32 %
Expected payoff -20.86
Gross Profit 5726.40
Gross Loss -13255.10
Total Net Profit -7528.70
-100%
-50%
0%
50%
100%
USD/CAD Jul 2025 - Sep 2025
0.44
Total Trades 752
Won Trades 183
Lost trades 569
Win Rate 24.34 %
Expected payoff -11.64
Gross Profit 6754.16
Gross Loss -15504.27
Total Net Profit -8750.11
-100%
-50%
0%
50%
100%
NZD/USD Jul 2025 - Sep 2025
0.58
Total Trades 1014
Won Trades 250
Lost trades 764
Win Rate 24.65 %
Expected payoff -9.00
Gross Profit 12717.00
Gross Loss -21846.20
Total Net Profit -9129.20
-100%
-50%
0%
50%
100%
GBP/USD Jul 2025 - Sep 2025
0.88
Total Trades 1659
Won Trades 507
Lost trades 1152
Win Rate 30.56 %
Expected payoff -2.29
Gross Profit 26636.40
Gross Loss -30437.90
Total Net Profit -3801.50
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
0.00
Total Trades 26
Won Trades 1
Lost trades 25
Win Rate 3.85 %
Expected payoff -312.58
Gross Profit 21.43
Gross Loss -8148.53
Total Net Profit -8127.10
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
0.18
Total Trades 178
Won Trades 34
Lost trades 144
Win Rate 19.10 %
Expected payoff -46.41
Gross Profit 1809.54
Gross Loss -10070.32
Total Net Profit -8260.78
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
0.33
Total Trades 303
Won Trades 86
Lost trades 217
Win Rate 28.38 %
Expected payoff -28.22
Gross Profit 4126.00
Gross Loss -12678.00
Total Net Profit -8552.00
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.47
Total Trades 565
Won Trades 147
Lost trades 418
Win Rate 26.02 %
Expected payoff -16.02
Gross Profit 8151.50
Gross Loss -17203.40
Total Net Profit -9051.90
-100%
-50%
0%
50%
100%
USD/CAD Oct 2024 - Jan 2025
0.21
Total Trades 226
Won Trades 41
Lost trades 185
Win Rate 18.14 %
Expected payoff -38.73
Gross Profit 2258.03
Gross Loss -11010.84
Total Net Profit -8752.81
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
0.21
Total Trades 201
Won Trades 40
Lost trades 161
Win Rate 19.90 %
Expected payoff -45.41
Gross Profit 2438.10
Gross Loss -11566.00
Total Net Profit -9127.90
-100%
-50%
0%
50%
100%

Comments