takeprofit 30 pips but error 130?

 
#define PipsTP 30
void OrderBuy(double Size)
{
       int ticket=0;
                  while (ticket <= 0)
                  {
                  ticket=OrderSend(Symbol(),1,Size,MarketInfo(Symbol(),MODE_ASK),3,0,MarketInfo(Symbol(),MODE_ASK)+MarketInfo(Symbol(),MODE_POINT)*PipsTP,"",Green);
                  Sleep(1000);
                       if(ticket<0)
                                 {
                                  Print("OrderSend failed with error #",GetLastError());
                                 }
                  }
} 

2012.11.08 17:13:37    2011.10.07 14:09  Bar GBPUSD,H1: OrderSend error 130

what is the problem guy????

 

If your MT4 broker uses five digit quotes, you have to multiply slippage, take_profit and stop_loss by 10, e.g.


int slippage       = 3*10;
double take_profit = MarketInfo(Symbol(),MODE_ASK)+MarketInfo(Symbol(),MODE_POINT)*PipsTP;
take_profit        = take_profit * 10.0;
ticket             = OrderSend(Symbol(),1,Size,MarketInfo(Symbol(),MODE_ASK),slippage,0,take_profit,"",Green);
 
abstract_mind:

If your MT4 broker uses five digit currency, you have to multiply slippage, take_profit and stop_loss by 10, e.g.



Erm, sometimes can buy and sell with TakeProfit 30 pips, but sometimes can't buy..i have no idea...my currency is GBPUSD and broker is FXCM
 
anthor:

2012.11.08 17:13:37    2011.10.07 14:09  Bar GBPUSD,H1: OrderSend error 130

what is the problem guy????

You have already been given advice,  why won't you take it ?  https://www.mql5.com/en/forum/141678

 

Is your Broker an ECN type Broker ? 

 
RaptorUK:

You have already been given advice,  why won't you take it ?  https://www.mql5.com/en/forum/141678

 

Is your Broker an ECN type Broker ? 


ticket=OrderSend(Symbol(),1,Size,Ask,30,0,(MarketInfo(Symbol(),MODE_ASK)+MarketInfo(Symbol(),MODE_POINT)*PipsTP)*10,"",Green);


adjusted slippage  for 3 to 30 and takeprofit multiply 10..still same the problem what.
 
RaptorUK:

Is your Broker an ECN type Broker ? 

Well ?
 
RaptorUK:
Well ?


ya..my broker is ECN broker
 
anthor:

ya..my broker is ECN broker
Well follow the link,  read,  learn,  change your code and be happy.  If you need it doing for you go here and pay:  MT4 & MT5 coding
 
int     pips2points=3;    // slippage  3 pips    3=points    30=points
double  pips2dbl=30;       // Stoploss 15 pips    0.015      0.0150
int     Digits.pips;    // DoubleToStr(dbl/pips2dbl, Digits.pips)
int init()
  {
//----
   if (Digits % 2 == 1){      // DE30=1/JPY=3/EURUSD=5 forum.mql4.com/43064#515262
                pips2dbl    = Point*10; pips2points = 10;   Digits.pips = 1;
    } else {    pips2dbl    = Point;    pips2points =  1;   Digits.pips = 0; }
//----
   return(0);
  }


void OrderSell(double Size)
{
       int ticket=0;
                  while (ticket <= 0)
                  {   
                  Print("awiting");  
                  Print("sell="+Bid+"/"+(MarketInfo(Symbol(),MODE_BID)-MarketInfo(Symbol(),MODE_POINT)*PipsTP));
                  ticket=OrderSend(Symbol(),1,Size,Bid,3* pips2points,0,Bid *  pips2dbl,"",Green);
                  Sleep(1000);
                         if(ticket<0)
                                 {
                                  Print("OrderSend failed with error #",GetLastError());
                                 }
                  }
} 
is this correct?  =)
 
anthor:
is this correct  =)

What is the point asking for help when you totally ignore the help you are given . . . 

 

 

 
RaptorUK:

What is the point asking for help when you totally ignore the help you are given . . . 

 

 


dude,i have followed the coding...if any mistake..pls advice.
Reason: