Daily 40 pips strategy

Hi,

Timeframe: Daily
Pairs: Any

At the start of each day (0:01) place pending Buy and Sell 40 pips from current price with TP/SL of 40 pips.

You could use the average daily range to estimate how many pips to place TP.

If a trade is in motion on the next day I sometimes move the SL and TP up again 40 pips from current Bid trailing the stop manually depending on momentum and trend direction.

There might be a better way to trail stop every 40 pips or so but this strategy seems to always gain at least 40 pips. Add many pairs and you have yourself a few pips.

It would be great if someone could code this in to an EA with money management and dashboard trading all pairs, way over my head.

Here is the template, indicators, scripts (pending orders and close all) and the broken ea.

DailyRange.zip (22.8 KB)

I’ve modified the send_pending script from MT4 to set the pending orders manually each night which saves some time.


//+------------------------------------------------------------------+
//|                                                 send_pending.mq4 |
//|                      Copyright © 2004, MetaQuotes Software Corp. |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link      ""
#property show_confirm

//+------------------------------------------------------------------+
//| script "send pending order with expiration data"                 |
//+------------------------------------------------------------------+
int start()
  {
   int    ticket,expiration;
   double point;
//----
   point=MarketInfo(Symbol(),MODE_POINT);
   expiration=CurTime()+PERIOD_D1*60;
//----
   while(true)
     {
      ticket=OrderSend(Symbol(),OP_SELLSTOP,1.0,Bid-400*point,0,Bid,Bid-800*point,"SELLSTOP",16384,expiration,Green);
      if(ticket<=0) Print("Error = ",GetLastError());
      else { Print("ticket = ",ticket); break; }
     }
   while(true)
     {
      ticket=OrderSend(Symbol(),OP_BUYSTOP,1.0,Bid+400*point,0,Bid,Bid+800*point,"BUYSTOP",16384,expiration,Green);
      if(ticket<=0) Print("Error = ",GetLastError());
      else { Print("ticket = ",ticket); break; }
	Sleep(10000);
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+

I tried to build a simple EA by using snippets of code and patching together but am seeing OrderSend error 130.



#property copyright "Copyright © 2013"
#property link      "[email protected]"

//---- input parameters
extern double    Lotsize=0.1;
extern double    iEma=200;

bool tradeOpen=false;
int ticket,point,expiration,order=0;
double yClose;

bool NewBar()
{
   static datetime lastbar = 0;
   datetime curbar = Time[0];
   if(lastbar!=curbar)
   {
      lastbar=curbar;
      return (true);
   }
   else
   {
      return(false);
   }
}

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----

  for(int pos=0;pos<OrdersTotal();pos++)
    {//Loop through existing orders
      if(OrderSelect(pos,SELECT_BY_POS)==false) continue;
      if(OrderSymbol()!=Symbol()) continue;//Order doesn't match current chart pair
      if(OrderSymbol()==Symbol())
        {//Order matches chart pair
          ticket=OrderTicket();
          tradeOpen=true;
          break;
        }//End order match
    }//End looping through open orders
    
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
/*
  int i=0,R10=0;
  double magic,raw,ravg,bsl,ssl,buy_tp,sell_tp;

  for(i=1;i<=10;i++)
    R10   =    R10 +  (iHigh(NULL,PERIOD_D1,i)-iLow(NULL,PERIOD_D1,i))/Point;

  raw = R10/10;
   
  ravg = 10 * (MathRound(((25 * (MathRound(raw / 25))) / 2) / 10));

  yClose=Close[1];
  magic=ravg*Point;
  bsl=Ask-magic;
  ssl=Bid+magic;
  buy_tp=Ask+magic;
  sell_tp=Bid-magic;
*/
  if((NewBar()==true)&&(DayOfWeek()!=0)&&(tradeOpen==false))
   { // start New Bar trade, but not on Sunday, nor if last trade still open
     iEma=iMA(NULL,0,50,0,MODE_EMA,PRICE_CLOSE,1);
     
     if(yClose>iEma)
       order=1;
     else
       {
     if(yClose<iEma)
        order=-1;
     else
        order=0;
       }
         
     if(order==1) // Buy
      {  
         ticket=OrderSend(Symbol(),OP_BUYSTOP,1.0,Bid+400*point,0,0,0,"BUYSTOP",16384,expiration,Green);
         if(ticket<=0) Print("Error = ",GetLastError());
         else Print("ticket = ",ticket);
         tradeOpen=true;
      }
     if(order==-1)//Sell
       { 

         ticket=OrderSend(Symbol(),OP_SELLSTOP,1.0,Bid-400*point,0,0,0,"SELLSTOP",16384,expiration,Green);
         if(ticket<=0) Print("Error = ",GetLastError());
         else Print("ticket = ",ticket);
         tradeOpen=true;
       }
     if(order==0)//Neither
       Alert("No valid signal on ",Symbol()," today.");

   } //End New Bar  
 /*  
   if(tradeOpen==true)
     {
       if(OrderSelect(ticket,SELECT_BY_TICKET)==true)
         {
           if(OrderCloseTime()!=0)
             tradeOpen=false;
         }
       else
         Print("OrderSelect returned the error of ",GetLastError());
     }  */
//----
   return(0);
  }

//+------------------------------------------------------------------+


How long have you been testing for? What sort of strike rate is this getting? Seems like a bit of a wing on a prayer with no money management?

Which currency pair seems to repond to this strategy the best and do you know the winning percentage?

I visual back tested a few pairs and the key is finding the pip distance for entry and TP. The system is based on the idea that if the pair moves 40pips it is usually going to go trend that way for the day, and more often than not it does.

The major pairs are the safer options. Although I just set my pending orders on all pairs then when I wake up manage the trades on a 1 hour chart.

Basically we need an EA to test the viability of this strategy. It probably isn’t much work to edit the above code if you know what you’re doing.

Results so far today

EURJPY - 40 pips
EURUSD - 15 pips (stop moved to breakeven hoping for 50EMA support on H1 chart)
GBPJPY - -2 pips (met strong resistance on H1 chart. Stop moved to -20 pips)

EURJPY closed trade - i’ve placed a marker at 80 pips where TP. You’ll notice it just catching the 40pips before a retrace :wink:


EURUSD open trades H1


GBPJPY open trades H1


Nice system.Could you post the template?

I’ve updated the first post with DailyRange.zip which contains everything. I’ve also included a CloseAll script to close all the pending trades.

Would be awesome if a simple EA could be coded :slight_smile:

Thanks for the system…Looks promising…What about not trading on Mondays? Usually Mondays tend to be a quiet day for trading?