Ordersend problem

 

Hello guys,

getting crazy for this problem:


////////////////////////////////////////////////////

extern double block=0.0047;

extern double stepin=20;

extern double stepout=4;


int HIG=iHighest(NULL, PERIOD_D1, MODE_HIGH, 3000, 0);

apex=iHigh(NULL,PERIOD_D1,HIG);


int res2=OrderSend(Symbol(),OP_BUYLIMIT,0.01,NormalizeDouble(apex*(1-(block*stepin)),0),5,NormalizeDouble(apex*((1-(block*stepin))*0.35),0),NormalizeDouble(apex*(1-(block*stepout)),0),"",MAGICMA,0,Blue);

////////////////////////////////////////////////////////


Everything seem to work fine but the order simply won't go... no error message received.


Any idea?


Thank you

 
  1. Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum (2019.05.06)
              Messages Editor

  2. No error message: Check your return codes, and report your errors (including market prices and your variables). Don't look at GLE/LE unless you have an error. Don't just silence the compiler (MT5/MT4+strict), it is trying to help you.
              What are Function return values ? How do I use them ? - MQL4 programming forum (2012.05.20)
              Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles (25 March 2014

  3. Where do you check that 0.0047 * 20 below the high is below the current market?
 

Thank you for your kind reply.


I've found out there was a problem of lot size. Very useful to add to the code:




int TicketNumber;

TicketNumber = OrderSend( . . . . . . . . );

if( TicketNumber > 0 )
   {
   Print("Order placed # ", TicketNumber);
   }
else
   {
   Print("Order Send failed, error # ", GetLastError() );
   }


to get the error code.


Thank you