Strategy tester error 130 - page 2

 
Ruptor:
Just a thought that you could place Stop orders of the same size instead of Stoploss and Take then delete the remaining pending order when there is no trade open since either the Stop above or below the trade has been hit and closed the trade with the opposite trade.

So place 3 trades ? and if I lose connection after these three trades are placed I am in triple the trouble ;-)
 
Yes and no. Place one trade and two pending trades at stoploss and take you can only get stuck with one pending trade in the wrong direction. The suggestion was a simple method of OCO that relies on the EA cancelling the remaining pending order once the open trade gets cancelled by the first pending order hit. I would suggest you have a backup method and IP internet connection like wireless or mobile in case of internet problems.
 
RaptorUK:

I've been looking at this particular problem for some time and am starting to feel I am missing something very obvious. Running on the Strategy tester I get error 130 consistently for some trades that happen during my testing period . . the vast majority of trades are fine. For example:

18:43:00 2008.03.20 12:35 OBTraderV2T GBPUSD,H1: Going long Bid= 1.9843

18:43:00 2008.03.20 12:35 OBTraderV2T GBPUSD,H1: Start of CheckTradesize Bid= 1.9843

18:43:00 2008.03.20 12:35 OBTraderV2T GBPUSD,H1: TradeSize = 1 TradeSizeBad = false NormTrade = 1 Bid= 1.9843 Ask= 1.9845

18:43:00 2008.03.20 12:35 OBTraderV2T GBPUSD,H1: open #22 buy stop 1.00 GBPUSD at 1.98446 sl: 1.97330 tp: 1.98616 ok

18:43:00 2008.03.20 12:35 OBTraderV2T GBPUSD,H1: RefreshRates: Bid= 1.9843 Ask= 1.9845

18:43:00 2008.03.20 12:38 Tester: order #22, buy 1.00 GBPUSD is opened at 1.98446

18:43:01 2008.03.20 21:10 Tester: take profit #22 at 1.98616 (1.98617 / 1.98633)

I use a BUY_STOP so I can set SL and TP (MBT ECN broker) . . another . . .

18:48:30 2008.03.27 10:17 OBTraderV2T GBPUSD,H1: Going long Bid= 2.0137

18:48:30 2008.03.27 10:17 OBTraderV2T GBPUSD,H1: Start of CheckTradesize Bid= 2.0137

18:48:30 2008.03.27 10:17 OBTraderV2T GBPUSD,H1: TradeSize = 1 TradeSizeBad = false NormTrade = 1 Bid= 2.0137 Ask= 2.0139

18:48:30 2008.03.27 10:17 OBTraderV2T GBPUSD,H1: open #23 buy stop 1.00 GBPUSD at 2.01386 sl: 2.00470 tp: 2.01527 ok

18:48:30 2008.03.27 10:17 OBTraderV2T GBPUSD,H1: RefreshRates: Bid= 2.0137 Ask= 2.0139

18:48:30 2008.03.27 10:18 Tester: order #23, buy 1.00 GBPUSD is opened at 2.01386

18:48:31 2008.03.27 10:24 Tester: take profit #23 at 2.01527 (2.01540 / 2.01556)

Now the error 130 . . .

18:49:36 2008.03.27 11:11 OBTraderV2T GBPUSD,H1: Going long Bid= 2.0173

18:49:36 2008.03.27 11:11 OBTraderV2T GBPUSD,H1: Start of CheckTradesize Bid= 2.0173

18:49:36 2008.03.27 11:11 OBTraderV2T GBPUSD,H1: TradeSize = 1 TradeSizeBad = false NormTrade = 1 Bid= 2.0173 Ask= 2.0175

18:49:36 2008.03.27 11:11 OBTraderV2T GBPUSD,H1: OrderSend error 130

18:49:36 2008.03.27 11:11 OBTraderV2T GBPUSD,H1: Error_Text = PlaceTrade: last error is . . .130

18:49:36 2008.03.27 11:11 OBTraderV2T GBPUSD,H1: OP_BUYSTOP: TradeSize= 1 Trade_Entry= 2.0171 Ask= 2.0175 Trade_SL= 2.0088 Trade_TP= 2.0194

18:49:36 2008.03.27 11:11 OBTraderV2T GBPUSD,H1: RefreshRates: Bid= 2.0173 Ask= 2.0175

Freeze Level and Stop Level are both 0.0, it's an ECN broker, but anyway, the Stops are a long way off on all 3 trades, the TPs are 16 pips, 13 pips
away from Ask and 19 pips for the trade that gave Error 130. As you can see from the RefreshRates entry the price is not changing super quickly . . . what am I missing ? any ideas ?

Hi RaptorUK, I am having a very similar problem with an EA that has worked well for months. After 2 months of not using it, I retried it and every trade gets the same error - "Error opening Sell Order : 130" - that would be great but the order placed was a BUY order. I tested the pip differences by adjusting the gaps both closer (within 10 points) and farther apart (50 points) but the error was the same and I couldn't shake it. I wondered about running in test mode but the prior use was in normal times during a currect chart run. I would add the broker name but that's probably frowned upon. If you find out why some brokers are randomly throwing this error at some traders I'd love to know the reason.


 
LimeyLad51:
Hi RaptorUK, I am having a very similar problem with an EA that has worked well for months. After 2 months of not using it, I retried it and every trade gets the same error - "Error opening Sell Order : 130" - that would be great but the order placed was a BUY order. I tested the pip differences by adjusting the gaps both closer (within 10 points) and farther apart (50 points) but the error was the same and I couldn't shake it. I wondered about running in test mode but the prior use was in normal times during a currect chart run. I would add the broker name but that's probably frowned upon. If you find out why some brokers are randomly throwing this error at some traders I'd love to know the reason.

Maybe your spread has opened up in the last few months ? is this an ECN broker ? can you show us the error taken from the log ?

 
I think I finally may have a handle on this issue from almost a year ago . . . I suspect I need to place my Buy Stop one point above Ask to ensure it complies with the rules here: https://book.mql4.com/appendix/limits it should be enough, that with a StopLevel of 0.0, that the Order can be placed at Ask but perhaps double precision gets in the way and Ask - OpenPrice ends up less than 0.0 in some rare cases . . . opening a point above Ask should address that issue.
 
OK, 76 test trades. all Buy or Sell stops at Ask + point or Bid - point . . . not a single error 130 :-) will need a different solution for 4 Digit Brokers though, opening a position at an additional 1 pip towards the TP is not going to help profitability.
Reason: