Semilong_www.forex-instruments.info

Author:
Profit factor:
0.91
Orders Execution
Checks for the total of open ordersIt automatically opens orders when conditions are reachedIt can change open orders parameters, due to possible stepping strategy
9 Views
0 Downloads
0 Favorites
Semilong_www.forex-instruments.info
//+------------------------------------------------------------------+
//|                                                pipsnja           |
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright ""
#property link      ""
//---- input parameters
extern int       Profit=120;
extern int       Loss=60;
extern int       Shift1=100;
extern int       Move1=60;
extern int       Shift2=10;
extern int       Move2=30;
extern int       Decr=14;
//----
extern double       Lots=1;
extern int Trailing=0;
extern bool  Autolot=true;
extern int   AutoMrgDiv=7;
//----
int Magic=1915;
int spr;
int tp,sl,d;
bool isOrder,buy,sell;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   spr=MarketInfo(Symbol(),MODE_SPREAD);
   if (Loss==0) sl=0; else sl=1;
   if (Profit==0) tp=0; else tp=1;
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
   //   if (CurTime()-Time[0]<=10) {
   int i;
   if (IsTradeAllowed()) isOrder=true;
     for(i=0; i<=OrdersTotal();i++) 
     {
      OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
      if (OrderMagicNumber()==Magic && OrderSymbol()==Symbol())isOrder=false;
     }
   buy=false;
   sell=false;
   if (Bid-Close[Shift1]<-Move1*Point && Close[Shift1]-Close[Shift1+Shift2]>Move2*Point) buy=true;
   if (Bid-Close[Shift1]>Move1*Point && Close[Shift1]-Close[Shift1+Shift2]<-Move2*Point) sell=true;
   if (AccountFreeMargin()<GetLots()*2000) isOrder=false;
   if (isOrder && buy) {OrderSend(Symbol(),OP_BUY,GetLots(),Ask,3,(Bid-(Loss)*Point)*sl,(Ask+(Profit+spr)*Point)*tp,"",Magic,0,FireBrick); d=Day();
   }
   if (isOrder && sell) {OrderSend(Symbol(),OP_SELL,GetLots(),Bid,3,(Ask+(Loss)*Point)*sl,(Bid-(Profit+spr)*Point)*tp,"",Magic,0,DarkViolet); d=Day();
   }
     if (Trailing>0) for(i=0; i<=OrdersTotal();i++) 
     {
         OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
           if (OrderMagicNumber()==Magic && OrderSymbol()==Symbol()) 
           {
            if (OrderType()==OP_BUY && Bid-OrderOpenPrice()>Trailing*Point && Bid-OrderStopLoss()>Trailing*Point)OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Trailing*Point,OrderTakeProfit(),0,CLR_NONE);
            if (OrderType()==OP_SELL && OrderOpenPrice()-Ask>Trailing*Point && OrderStopLoss()-Ask>Trailing*Point)OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Trailing*Point,OrderTakeProfit(),0,CLR_NONE);
           }
        }
//----
   return(0);
  }
//+------------------------------------------------------------------+
double GetLots()
  {
   double res;
     if (Autolot) 
     {
      res=NormalizeDouble(AccountFreeMargin()/(AutoMrgDiv*1000),0);
        if (Decr>0) 
        {
         int losses=0;
         for(int j=HistoryTotal()-1;j>=0;j--)
           {
            if(OrderSelect(j,SELECT_BY_POS,MODE_HISTORY)==false) { Print("Error in history!"); break; }
            if(OrderSymbol()!=Symbol() || OrderMagicNumber()!=Magic)continue;
            //----
            if(OrderProfit()>0) break;
            if(OrderProfit()<0) losses++;
           }
         if(losses>1) res=NormalizeDouble(res-res*losses/Decr,0);
        }
      if (res<Lots) res=Lots;
      if (res>99) res=99;
      return(res);
     }
      else return(Lots);
  }
//+------------------------------------------------------------------+

Profitability Reports

NZD/USD Jul 2025 - Sep 2025
0.62
Total Trades 352
Won Trades 91
Lost trades 261
Win Rate 25.85 %
Expected payoff -20.96
Gross Profit 12198.00
Gross Loss -19575.00
Total Net Profit -7377.00
-100%
-50%
0%
50%
100%
GBP/USD Jul 2025 - Sep 2025
0.72
Total Trades 527
Won Trades 150
Lost trades 377
Win Rate 28.46 %
Expected payoff -15.23
Gross Profit 20250.00
Gross Loss -28275.00
Total Net Profit -8025.00
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
0.19
Total Trades 80
Won Trades 10
Lost trades 70
Win Rate 12.50 %
Expected payoff -101.23
Gross Profit 1849.77
Gross Loss -9948.56
Total Net Profit -8098.79
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
0.15
Total Trades 86
Won Trades 9
Lost trades 77
Win Rate 10.47 %
Expected payoff -93.21
Gross Profit 1459.03
Gross Loss -9475.09
Total Net Profit -8016.06
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
3.53
Total Trades 2335
Won Trades 1564
Lost trades 771
Win Rate 66.98 %
Expected payoff 5443.87
Gross Profit 17732742.00
Gross Loss -5021305.00
Total Net Profit 12711437.00
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.70
Total Trades 327
Won Trades 91
Lost trades 236
Win Rate 27.83 %
Expected payoff -16.15
Gross Profit 12194.00
Gross Loss -17475.00
Total Net Profit -5281.00
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
0.68
Total Trades 443
Won Trades 122
Lost trades 321
Win Rate 27.54 %
Expected payoff -18.07
Gross Profit 16714.00
Gross Loss -24717.00
Total Net Profit -8003.00
-100%
-50%
0%
50%
100%
AUD/USD Oct 2024 - Jan 2025
0.68
Total Trades 449
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -17.92
Gross Profit 16728.00
Gross Loss -24776.00
Total Net Profit -8048.00
-100%
-50%
0%
50%
100%

Comments