Automated trading problem

 

Hi,

I am trying to make a simple script to just buy some stocks automatically.

I used the following code:

void OnStart()
  {
  MqlTradeRequest request={0};
  MqlTradeResult result={0};
  request.symbol=_Symbol;
  request.volume=1;
  request.price=112;
  request.action=TRADE_ACTION_PENDING;
  request.type=ORDER_TYPE_BUY_LIMIT;
  request.type_time=ORDER_TIME_DAY;

  if(!OrderSend(request,result))
      PrintFormat("OrderSend error %d",GetLastError());
   PrintFormat("retcode=%u  deal=%I64u  order=%I64u",result.retcode,result.deal,result.order);
   Sleep(1);
   }

But I got the following results : 

buy limit 1.00 "my symbol name" at 112

accepted buy limit 1.00 "my symbol name" at 112

rejected buy limit 1.00 "my symbol name" at 112

What is the problem? 


 
Perhaps the market was at or below 112 at the time, therefor the limit couldn't be placed. Why didn't you post the result? There are no mind readers here.
 
saeeds255:

Hi,

I am trying to make a simple script to just buy some stocks automatically.

I used the following code:

void OnStart()
  {
  MqlTradeRequest request={0};
  MqlTradeResult result={0};
  request.symbol=_Symbol;
  request.volume=1;
  request.price=112;
  request.action=TRADE_ACTION_PENDING;
  request.type=ORDER_TYPE_BUY_LIMIT;
  request.type_time=ORDER_TIME_DAY;

  if(!OrderSend(request,result))
      PrintFormat("OrderSend error %d",GetLastError());
   PrintFormat("retcode=%u  deal=%I64u  order=%I64u",result.retcode,result.deal,result.order);
   Sleep(1);
   }

But I got the following results : 

buy limit 1.00 "my symbol name" at 112

accepted buy limit 1.00 "my symbol name" at 112

rejected buy limit 1.00 "my symbol name" at 112

What is the problem? 


What is printed in the log ? Is it private information or what ?