Author: fortrader
Profit factor:
0.22
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
1 Views
0 Downloads
0 Favorites
10pips
//+------------------------------------------------------------------+
//|                                                       10pips.mq4 |
//|                                                        fortrader |
//|                                                 www.fortrader.ru |
//+------------------------------------------------------------------+
#property copyright "fortrader"
#property link      "www.fortrader.ru"

extern int       TakeProfit_Buy = 10;
extern int       StopLoss_Buy = 50;
extern int       TrailingStop_Buy = 50;
extern int       TakeProfit_Sell = 10;
extern int       StopLoss_Sell = 50;
extern int       TrailingStop_Sell = 50;
extern double     Lots = 0.1;

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
  if (Volume[0] > 1) return(0);
// Îáúÿâëÿåì ïåðåìåííûå
int total, cnt;

  total=OrdersTotal();

  // Ïðîâåðêà ñðåäñòâ
  if(AccountFreeMargin()<(1000*Lots))
     {
       Print("We have no money. Free Margin = ", AccountFreeMargin());   
       return(0);  
     }
  if(total<1)
    {  
     // Îòêðûòèå ñäåëêîê
       OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Bid-StopLoss_Buy*Point,Ask+TakeProfit_Buy*Point,"Ïîêóïàåì",16384,0,Green);
       Sleep(10000);//10 ñåêóíä
       RefreshRates();
       OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Ask+StopLoss_Sell*Point,Bid-TakeProfit_Sell*Point,"Ïðîäàåì",16385,0,Red);
    }
  if(total==1)
    {
       OrderSelect(0, SELECT_BY_POS, MODE_TRADES);
       if(OrderType()==OP_BUY)
         {
           OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Bid-StopLoss_Buy*Point,Ask+TakeProfit_Buy*Point,"Ïîêóïàåì",16384,0,Green);
         }
       if(OrderType()==OP_SELL)
         {
           OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Ask+StopLoss_Sell*Point,Bid-TakeProfit_Sell*Point,"Ïðîäàåì",16385,0,Red);
         }
    }   
  for(cnt=total-1;cnt>=0;cnt--)
     {
       OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
       if(OrderType()==OP_BUY)
         {
           if(TrailingStop_Buy>0)  
             {                 
               if(Bid-OrderOpenPrice()>Point*TrailingStop_Buy) // Bid - öåíà ïîêóïêè
                 {
                   if(OrderStopLoss()<Bid-Point*TrailingStop_Buy)
                     {
                       OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop_Buy,OrderTakeProfit(),0,Green);
                       return(0);
                     }
                 }
             }
         }
       if(OrderType()==OP_SELL)
         {
           if(TrailingStop_Sell>0)  
             {                 
               if((OrderOpenPrice()-Ask)>(Point*TrailingStop_Sell))  // Ask - öåíà ïðîäàæè
                 {
                   if((OrderStopLoss()>(Ask+Point*TrailingStop_Sell)) || (OrderStopLoss()==0))
                     {
                       OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop_Sell,OrderTakeProfit(),0,Red);
                       return(0);
                     }
                 }
             }
         }
  
     }
   
//----
   return(0);
  }
//+------------------------------------------------------------------+

Profitability Reports

USD/CAD Oct 2024 - Jan 2025
0.23
Total Trades 2828
Won Trades 1734
Lost trades 1094
Win Rate 61.32 %
Expected payoff -1.49
Gross Profit 1237.05
Gross Loss -5460.62
Total Net Profit -4223.57
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
0.12
Total Trades 2425
Won Trades 1255
Lost trades 1170
Win Rate 51.75 %
Expected payoff -3.63
Gross Profit 1255.00
Gross Loss -10052.00
Total Net Profit -8797.00
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
0.30
Total Trades 3076
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -1.55
Gross Profit 2045.00
Gross Loss -6803.10
Total Net Profit -4758.10
-100%
-50%
0%
50%
100%

Comments