Try sending the order without Sl and Tp.
Try sending the order without Sl and Tp.
Hi ubzen, I'll do. I just add a MarketInfo(Symbol(),MODE_STOPLEVEL) and I got this:
2011.05.31 - 21:00:00 - - - Buy Signal! 2011.05.31 - 21:00:00 - - - Wise long: 0.71709490 2011.05.31 - 21:00:00 - - - Opening Long Pos! 2011.05.31 - 21:00:00 - - - 31.5.2011 21:0:32 2011.05.31 - 21:00:00 - - - Trying to open a buy order, attempt 1 2011.05.31 - 21:00:00 - - - nAsk: 1.43989000, StopLoss: 180, TakeProfit: 250 2011.05.31 - 21:00:00 - - - StopLoss Level: 1.42189000, TakeProfit Level: 1.46489000 2011.05.31 - 21:00:00 - - - STOPLEVEL=1.00000000 2011.05.31 - 21:00:00 - - - failed, error 130 2011.05.31 - 21:00:00 - - - 31.5.2011 21:0:32 2011.05.31 - 21:00:00 - - - Trying to open a buy order, attempt 2 2011.05.31 - 21:00:00 - - - nAsk: 1.43989000, StopLoss: 180, TakeProfit: 250 2011.05.31 - 21:00:00 - - - StopLoss Level: 1.42189000, TakeProfit Level: 1.46489000 2011.05.31 - 21:00:00 - - - STOPLEVEL=1.00000000 2011.05.31 - 21:00:00 - - - failed, error 130 2011.05.31 - 21:00:00 - - - 31.5.2011 21:0:32 2011.05.31 - 21:00:00 - - - Trying to open a buy order, attempt 3 2011.05.31 - 21:00:00 - - - nAsk: 1.43989000, StopLoss: 180, TakeProfit: 250 2011.05.31 - 21:00:00 - - - StopLoss Level: 1.42189000, TakeProfit Level: 1.46489000 2011.05.31 - 21:00:00 - - - STOPLEVEL=1.00000000 2011.05.31 - 21:00:00 - - - failed, error 130 2011.05.31 - 21:00:00 - - - 31.5.2011 21:0:32 2011.05.31 - 21:00:00 - - - Trying to open a buy order, attempt 4 2011.05.31 - 21:00:00 - - - nAsk: 1.43989000, StopLoss: 180, TakeProfit: 250 2011.05.31 - 21:00:00 - - - StopLoss Level: 1.42189000, TakeProfit Level: 1.46489000 2011.05.31 - 21:00:00 - - - STOPLEVEL=1.00000000 2011.05.31 - 21:00:00 - - - failed, error 130 2011.05.31 - 21:00:00 - - - 31.5.2011 21:0:32 2011.05.31 - 21:00:00 - - - Trying to open a buy order, attempt 5 2011.05.31 - 21:00:00 - - - nAsk: 1.43989000, StopLoss: 180, TakeProfit: 250 2011.05.31 - 21:00:00 - - - StopLoss Level: 1.42189000, TakeProfit Level: 1.46489000 2011.05.31 - 21:00:00 - - - STOPLEVEL=1.00000000 2011.05.31 - 21:00:00 - - - failed, error 130 2011.05.31 - 21:00:00 - - - 31.5.2011 21:0:32 2011.05.31 - 21:00:00 - - - Trying to open a buy order, attempt 6 2011.05.31 - 21:00:00 - - - nAsk: 1.43989000, StopLoss: 180, TakeProfit: 250 2011.05.31 - 21:00:00 - - - StopLoss Level: 1.42189000, TakeProfit Level: 1.46489000 2011.05.31 - 21:00:00 - - - STOPLEVEL=1.00000000 2011.05.31 - 21:00:00 - - - failed, error 130 2011.05.31 - 21:00:00 - - - 31.5.2011 21:0:32 2011.05.31 - 21:00:00 - - - Trying to open a buy order, attempt 7 2011.05.31 - 21:00:00 - - - nAsk: 1.43989000, StopLoss: 180, TakeProfit: 250 2011.05.31 - 21:00:00 - - - StopLoss Level: 1.42189000, TakeProfit Level: 1.46489000 2011.05.31 - 21:00:00 - - - STOPLEVEL=1.00000000 2011.05.31 - 21:00:00 - - - failed, error 130 2011.05.31 - 21:00:00 - - - 31.5.2011 21:0:32 2011.05.31 - 21:00:00 - - - Trying to open a buy order, attempt 8 2011.05.31 - 21:00:00 - - - nAsk: 1.43989000, StopLoss: 180, TakeProfit: 250 2011.05.31 - 21:00:00 - - - StopLoss Level: 1.42189000, TakeProfit Level: 1.46489000 2011.05.31 - 21:00:00 - - - STOPLEVEL=1.00000000 2011.05.31 - 21:00:00 - - - failed, error 130 2011.05.31 - 21:00:00 - - - 31.5.2011 21:0:32 2011.05.31 - 21:00:00 - - - Trying to open a buy order, attempt 9 2011.05.31 - 21:00:00 - - - nAsk: 1.43989000, StopLoss: 180, TakeProfit: 250 2011.05.31 - 21:00:00 - - - StopLoss Level: 1.42189000, TakeProfit Level: 1.46489000 2011.05.31 - 21:00:00 - - - STOPLEVEL=1.00000000 2011.05.31 - 21:00:00 - - - failed, error 130 2011.05.31 - 21:00:00 - - - 31.5.2011 21:2:12 2011.05.31 - 21:00:00 - - - Trying to open a buy order, attempt 10 2011.05.31 - 21:00:00 - - - nAsk: 1.43979000, StopLoss: 180, TakeProfit: 250 2011.05.31 - 21:00:00 - - - StopLoss Level: 1.42189000, TakeProfit Level: 1.46489000 2011.05.31 - 21:00:00 - - - STOPLEVEL=1.00000000 2011.05.31 - 21:00:00 - - - failed, error 130 2011.05.31 - 21:00:00 - - - NN_TRAINING after 10 attempts, buy error: 130 Ask: 1.43974000, Stop Loss=180, Take Profit=250
Without the stop loss there isn't a problem :
2011.05.31 - 21:05:00 - - - Sell Signal! 2011.05.31 - 21:05:00 - - - Wise long: 0.71088575 2011.05.31 - 21:05:00 - - - Opening Short Pos! 2011.05.31 - 21:05:00 - - - 31.5.2011 21:8:11 2011.05.31 - 21:05:00 - - - Trying to open a sell order, attempt 1 2011.05.31 - 21:05:00 - - - nBid: 1.43919000, StopLoss: 0, TakeProfit: 0 2011.05.31 - 21:05:00 - - - StopLoss Level: 0.00000000, TakeProfit Level: 0.00000000 2011.05.31 - 21:05:00 - - - STOPLEVEL=1.00000000 2011.05.31 - 21:05:00 - - - successfull !!!!, Short Order Opened with Ticket No: 98305364
Without the stop loss there isn't a problem :
I just figured out the problem, my broker doesn't accept S/L or T/P on OrderSend function, I have to mod the order to add S/L and T/P later.
No biggy but that sucks.
Thank ubzen.
Hi I encountered the same problem too. If I do OrderSend in EA for a buy or sell order with SL and TP included, I get the error.
Find it strange this is not allowed when the same can be done manually.
So no choice but to put 0 in SL and TP and use OrderModify.
So is this the way to code it ?
ticket = OrderSend(Symbol(), OP_BUY, LotSize,Ask, 2, 0, 0, "", Magic+2, 0,Green); //Do order send to open order without SL/TP and also get ticket number
OrderModify(ticket,OrderOpenPrice(),OrderOpenPrice()-0.0020,OrderOpenPrice()+0.0020,0); //Use the unique ticket number to modify the SL/TP.
Cheers,
hip
//++++ These are adjusted for 5 digit brokers. int pips2points; // slippage 3 pips 3=points 30=points double pips2dbl; // Stoploss 15 pips 0.015 0.0150 int Digits.pips; // DoubleToStr(dbl/pips2dbl, Digits.pips) int init(){ OptParameters(); 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; } // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl //---- These are adjusted for 5 digit brokers. /* On ECN brokers you must open first and THEN set stops int ticket = OrderSend(..., 0,0,...) if (ticket < 0) Alert("OrderSend failed: ", GetLastError()); else if (!OrderSelect(ticket, SELECT_BY_TICKET)) Alert("OrderSelect failed: ", GetLastError()); else if (!OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0) Alert("OrderModify failed: ", GetLastError()); */

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello guys,
I have run this in tester and haven't get any error, as soon I go to live trade I get error 130. Could you please give some thoughs to this?
This is the open order code I have in a separate file in the include folder, GetLotSize() is my money mngmt, dTakeProfit is set to 180 pips, dTakeProfit to 270 pips set as global variables.
This is the part of the code that calls Buy, ann_wise_long is my trigger signal to open a buy order.
And this is the output to file the first one is from the tester, the second from the live trade:
Here the live trade:
As you can see the Buy order stop loss is 180 pips below the Ask price. Is it there any explanation why I get error 130 in live trade and not in testing withthe same EA?
Thanks.