Download MetaTrader 5
To add comments, please log in or register
Looking for like-minded people? You will find lots of them on the Forum!
cryptex23
268
cryptex23 2014.02.28 09:45 
input double TakeProfit    =50;
input double Lots          =0.1;

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnTick(void)
  {
     
   int    ticket,total;

if(-20<=-10)
   

   total=OrdersTotal();
   if(total<1)
     {   
         ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask,Ask+TakeProfit*Point,"trial",16384,0,Green);
         if(ticket>0)
           {
            if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))
               Print("BUY order opened : ",OrderOpenPrice());
           }
         else
            Print("Error opening BUY order : ",GetLastError());
         return;
       }
I have simply copied this from macd sample EA. For some reason upon testing the strategy not a single trade is executed :(
Keith Watford
Moderator
7887
Keith Watford 2014.02.28 10:15  
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask,Ask+TakeProfit*Point,"trial",16384,0,Green);

You cannot open a trade at Ask and also set the SL at Ask

qjol
3243
qjol 2014.02.28 10:20  
if(-20<=-10) ?? 

obviously -20 is smaller than -10

cryptex23
268
cryptex23 2014.02.28 11:05  
qjol:

obviously -20 is smaller than -10


ya wrote is so cause the code wasnt running for the conditions that i am actually using
cryptex23
268
cryptex23 2014.02.28 11:07  
GumRai:

You cannot open a trade at Ask and also set the SL at Ask


Dude thanks a lot. Finally I can sleep :D _/\_
/
To add comments, please log in or register