Author: Copyright � 2005, MetaQuotes Software Corp.
Profit factor:
0.50
Price Data Components
Series array that contains the highest prices of each barSeries array that contains the highest prices of each barSeries array that contains the lowest prices of each barSeries array that contains the lowest prices of each bar
Orders Execution
Checks for the total of open ordersIt Closes Orders by itself It can change open orders parameters, due to possible stepping strategyIt automatically opens orders when conditions are reached
2 Views
0 Downloads
0 Favorites
scalping
//+------------------------------------------------------------------+
//|                                                     scalping.mq4 |
//|                      Copyright © 2005, MetaQuotes Software Corp. |
//|                                        http://www.scalping.nm.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, MetaQuotes Software Corp."
#property link      "http://www.scalping.nm.ru"

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
extern int SL=57,TP=100,TS=35; 
extern double UDayChanel=0.004;
extern int StartTime=6,EndTime=11;
extern double lots=1;
int init()
  {
//---- 
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
int total,cnt;
double HighPrice,LowPrice,DayChanel;
//----
HighPrice=iHigh(Symbol(),PERIOD_D1,0);
LowPrice=iLow(Symbol(),PERIOD_D1,0);
DayChanel=HighPrice-LowPrice;

total=OrdersTotal();
for(cnt=0;cnt<total;cnt++)
{
   OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
   if(OrderType()<=OP_SELL && 
   OrderSymbol()==Symbol())   
   {
      if(OrderType()==OP_BUY)   
      {
         if(Hour()>EndTime)
         {
            OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet); 
            return(0); 
         }
         if(TS>0)  
         {                
            if(Bid-OrderOpenPrice()>Point*TS)
            {
               if(OrderStopLoss()<Bid-Point*TS)
               {
                  OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TS,OrderTakeProfit(),0,Red);
                  return(0);
               }
            }
         }
      }
      else 
      {
         if(Hour()>EndTime)
         {
            OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet); 
            return(0); 
         }
         if(TS>0)  
         {    
            if((OrderOpenPrice()-Ask)>(Point*TS))
            {
               if(OrderStopLoss()==0.0 || 
               OrderStopLoss()>(Ask+Point*TS))
               {
                  OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TS,OrderTakeProfit(),0,Red);
                  return(0);
               }
            }
          }
      }
   }
}
 
if (Hour()>=StartTime &&   Hour()<EndTime)
{
   if (AccountFreeMargin()>=2000) lots=1;
   if (AccountFreeMargin()>=3000) lots=1;
   if (AccountFreeMargin()>=4000) lots=2;
   if (AccountFreeMargin()>=5000) lots=3;
   if (AccountFreeMargin()>=6000) lots=4;
   if (AccountFreeMargin()>=7000) lots=5;
   if (AccountFreeMargin()>=8000) lots=6;
   if (AccountFreeMargin()>=9000) lots=7;
   if (AccountFreeMargin()>=10000) lots=8;
   if (AccountFreeMargin()>=11000) lots=9;
   if (DayChanel>=UDayChanel)
   {
   Print(Day(),"/",Month()," - ",Hour(),":",Minute()," - H",HighPrice," L",LowPrice," Ch",DayChanel," OB:",MathCeil(AccountFreeMargin()/1000)," LOT",lots);
      total=OrdersTotal();
      if (total==0)
      {
         OrderSend(Symbol(),OP_SELL,lots,LowPrice,0,LowPrice+SL*Point,LowPrice-TP*Point,"Scalp",16384,0,Red); OrderSend(Symbol(),OP_BUY,1,HighPrice,0,HighPrice-SL*Point,HighPrice+TP*Point,"Scalp",16384,0,Blue); 
         OrderSend(Symbol(),OP_BUY,lots,HighPrice,0,HighPrice-SL*Point,HighPrice+TP*Point,"Scalp",16384,0,Red); 
         return(0);
      }
      if (total==1)
      {
         OrderSelect(1,SELECT_BY_POS,MODE_TRADES);
         if (OrderSymbol()==Symbol())
         {
            if (OrderType()==OP_BUYSTOP)
            {
               OrderSend(Symbol(),OP_SELLSTOP,lots,LowPrice,0,LowPrice+SL*Point,LowPrice-TP*Point,"Scalp",16384,0,Red); OrderSend(Symbol(),OP_BUY,1,HighPrice,0,HighPrice-SL*Point,HighPrice+TP*Point,"Scalp",16384,0,Blue); 
            }
            if (OrderType()==OP_SELLSTOP)
            {
               OrderSend(Symbol(),OP_BUYSTOP,lots,HighPrice,0,HighPrice-SL*Point,HighPrice+TP*Point,"Scalp",16384,0,Red); OrderSend(Symbol(),OP_BUY,1,HighPrice,0,HighPrice-SL*Point,HighPrice+TP*Point,"Scalp",16384,0,Blue); 
            }
         }
         return(0);
      }
      if (total==2)
      {
         return(0);
      }
   }
}

//----
   return(0);
  }
//+------------------------------------------------------------------+

Profitability Reports

NZD/USD Oct 2024 - Jan 2025
0.20
Total Trades 69
Won Trades 18
Lost trades 51
Win Rate 26.09 %
Expected payoff -85.78
Gross Profit 1522.00
Gross Loss -7441.00
Total Net Profit -5919.00
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
0.81
Total Trades 196
Won Trades 87
Lost trades 109
Win Rate 44.39 %
Expected payoff -24.62
Gross Profit 20413.00
Gross Loss -25238.00
Total Net Profit -4825.00
-100%
-50%
0%
50%
100%
AUD/USD Oct 2024 - Jan 2025
0.49
Total Trades 52
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -54.77
Gross Profit 2736.00
Gross Loss -5584.00
Total Net Profit -2848.00
-100%
-50%
0%
50%
100%

Comments