Error #130?

 

Hello,


I have an error message #130 and I don't understand what is it...

I trade on the EUR/USD forex.


if (OrderType()==OP_BUY && OrderSymbol()==Symbol()&& OrdersTotal()==1)

{

OrderClose(OrderTicket(),OrderLots(),Bid,0,Green);

}

ticket=OrderSend(Symbol(),OP_SELL,lots,Bid,3,1.40,1.30,"Ordre Court",0,0,Red);

This mistake comes from the stopprofit and stoploss, but I don't see what. I tries mpany values...


Thanks


 

Not totally sure, but what if you use "Bid+25*Point,Bid-50*Point" instead of the two values you use? Also it could help if you want to use the actual levels, try 14000*Point and 13000*Point or 140000*Point depending on if your broker use fractional pips or not.

But I never used actual values, only the distance from the OrderOpenPrice

 

Hello,

I tried the two ways but it doesn't work... very strange, I don't understand. My broker is FXCM

 

Hello olosta

May I recommend to you this link? It is part of the MQL book. Order Characteristics and Rules for Making Trades

.

Have you read the book yet?

You would not be dissappointed :)

 

Try changing

ticket=OrderSend(Symbol(),OP_SELL,lots,Bid,3,1.40,1.30,"Ordre Court",0,0,Red);

to

ticket=OrderSend(Symbol(),OP_SELL,lots,Bid,3,Bid+250*Point,Bid-500*Point,"Ordre Court",0,0,Red);


CB

 

Hi all,

I tried but it still doesn't work. I have seen that when I want to put a trade manually, I cannot put stoploss and profit target => it is in "grey". When I choose Buy Limit or Buy stop, the SL and PT fields are available.

So I tried with the option "OP_BUYLIMIT", "OP_SELLLIMIT", "OP_BUYSTOP" and "OP_SELLSTOP", and it works perfectly.


May be it is not possible to use the PT and the SL with the "OP_SELL" and "OP_BUY" from the ordersend() ?

I am going to read the previous link to see if I find something...


If someone has a solution ?


Many thanks for your efforts ;)

 
olosta:

Hi all,

I tried but it still doesn't work. I have seen that when I want to put a trade manually, I cannot put stoploss and profit target => it is in "grey". When I choose Buy Limit or Buy stop, the SL and PT fields are available.

So I tried with the option "OP_BUYLIMIT", "OP_SELLLIMIT", "OP_BUYSTOP" and "OP_SELLSTOP", and it works perfectly.


May be it is not possible to use the PT and the SL with the "OP_SELL" and "OP_BUY" from the ordersend() ?

I am going to read the previous link to see if I find something...


If someone has a solution ?


Many thanks for your efforts ;)

I can assure you that we all use StopLoss and TakeProfit with OP_SELL and OP_BUY types in the OrderSend() function.

You will normally configure them in extern variables as a relative number of pips away from the price and then include them in the OrderSend() function as a calculated absolute price as we've shown you above.

I recommend that you use the following function (just as a temporary test - you could even create a little EA that does only this command in the init() function):

Print("My broker's stoplevel is : ",MarketInfo(Symbol(),MODE_STOPLEVEL));


CB

 

Hello olosta, I use Alpari UK - they use 3,5 pip prices - no issues with your send.

Consider using Print() of all OrderSend(...actuals...);

That way there can be no discussions regards what or what not you are giving OrderSend().

Please use DoubleToStr(<yourValue>,Digits) in your Print() calls.

Unless you have complete picture of what you are asking your code to do, is not really that easy guessing about it, is it?

Regards

.

code:

int start()
{
double lots=0.01;
int ticket=OrderSend(Symbol(),OP_SELL,lots,Bid,3,Bid+250*Point,Bid-500*Point,"Ordre Court",0,0,Red);
printMarketInfo();
return;
}
.

results in:

.

EURUSD,M5: open #57382862 sell 0.01 EURUSD at 1.39068 sl: 1.39318 tp: 1.38568 ok

EURUSD,M5: > > > REF.1: "Order Characteristics and Rules for Making Trades" https://book.mql4.com/trading/orders < < <
EURUSD,M5: > > > REF.2: "Requirements and Limitations in Making Trades" https://book.mql4.com/appendix/limits < < <
EURUSD,M5: MODE_FREEZELEVEL=0.00000000
EURUSD,M5: MODE_MARGINREQUIRED=278.17000000
EURUSD,M5: MODE_MARGINHEDGED=50000.00000000
EURUSD,M5: MODE_MARGINMAINTENANCE=0.00000000
EURUSD,M5: MODE_MARGININIT=0.00000000
EURUSD,M5: MODE_MARGINCALC=0
EURUSD,M5: MODE_PROFITCALC=0
EURUSD,M5: MODE_SWAPTYPE=0
EURUSD,M5: MODE_LOTSIZE=100000.00000000, "Base CCY"
EURUSD,M5: MODE_MAXLOT=99999.00000000
EURUSD,M5: MODE_LOTSTEP=0.01000000
EURUSD,M5: MODE_MINLOT=0.01000000
EURUSD,M5: MODE_TRADEALLOWED=1
EURUSD,M5: MODE_EXPIRATION=0
EURUSD,M5: MODE_STARTING=0
EURUSD,M5: MODE_SWAPSHORT=0.20000000
EURUSD,M5: MODE_SWAPLONG=-0.50000000
EURUSD,M5: MODE_TICKSIZE=0.00001000
EURUSD,M5: MODE_TICKVALUE=1.00000000
EURUSD,M5: MODE_STOPLEVEL=20.00000000
EURUSD,M5: MODE_SPREAD=18.00000000
EURUSD,M5: MODE_DIGITS=5
EURUSD,M5: MODE_POINT=0.00001000
EURUSD,M5: MODE_ASK=1.39086000
EURUSD,M5: MODE_BID=1.39068000
EURUSD,M5: MODE_TIME=2009.07.10 13:08:02
EURUSD,M5: MODE_HIGH=1.40297000
EURUSD,M5: MODE_LOW=1.38777000


 

Hello,


Is that you are asking me to put ?

I put here my config with the MarketInfo()

15:23:09 test2 EURUSD,M1: market info MODE_LOW:1.3877

15:23:09 test2 EURUSD,M1: market info MODE_HIGH:1.4024

15:23:09 test2 EURUSD,M1: market info MODE_TIME:1247235780

15:23:09 test2 EURUSD,M1: market info MODE_BID:1.39

15:23:09 test2 EURUSD,M1: market info MODE_ASK:1.3903

15:23:09 test2 EURUSD,M1: market info MODE_POINT:0

15:23:09 test2 EURUSD,M1: market info MODE_DIGITS:5

15:23:09 test2 EURUSD,M1: market info MODE_SPREAD:22

15:23:09 test2 EURUSD,M1: market info MODE_STOPLEVEL:0

15:23:09 test2 EURUSD,M1: market info MODE_LOTSIZE:100000

15:23:09 test2 EURUSD,M1: market info MODE_TICKVALUE:1

15:23:09 test2 EURUSD,M1: market info MODE_TICKSIZE:0

15:23:09 test2 EURUSD,M1: market info MODE_SWAPLONG:-5

15:23:09 test2 EURUSD,M1: market info MODE_SWAPSHORT:-5

15:23:09 test2 EURUSD,M1: market info MODE_STARTING:0

15:23:09 test2 EURUSD,M1: market info MODE_EXPIRATION:0

15:23:09 test2 EURUSD,M1: market info MODE_TRADEALLOWED:1

15:23:09 test2 EURUSD,M1: market info MODE_MINLOT:0.1

15:23:09 test2 EURUSD,M1: market info MODE_LOTSTEP:0.1

15:23:09 test2 EURUSD,M1: market info MODE_MAXLOT:100

15:23:09 test2 EURUSD,M1: market info MODE_SWAPTYPE:1

15:23:09 test2 EURUSD,M1: market info MODE_PROFITCALCMODE:0

15:23:09 test2 EURUSD,M1: market info MODE_MARGINCALCMODE:0

15:23:09 test2 EURUSD,M1: market info MODE_MARGININIT:100000

15:23:09 test2 EURUSD,M1: market info MODE_MARGINMAINTENANCE:100000

15:23:09 test2 EURUSD,M1: market info MODE_MARGINHEDGED:50000

15:23:09 test2 EURUSD,M1: market info MODE_MARGINREQUIRED:500

15:23:09 test2 EURUSD,M1: market info MODE_FREEZELEVEL:0

15:23:09 test2 EURUSD,M1: OrderSend failed with error #130

 

Where are the Print() statement results?

Must know exactly what passing to OrderSend()

please do as CB says. use Print() and print out ALL values you are passing to OrderSend(), not just ones you feel maybe are at fault. And not leave out those you feel maybe are ok.

Is no good "feel", "maybe". You must know 100% what values and Print() is your friend.

.

Why MODE_POINT return zero?

I seem remember some issue but not now. Do you have EURUSD listed in Market Watch window? If not, add this symbol > rerun test2.

Since MODE_DIGITS:5 I would expect MODE_POINT:0.00001

.

15:23:09 test2 EURUSD,M1: market info MODE_POINT:0

15:23:09 test2 EURUSD,M1: market info MODE_DIGITS:5

15:23:09 test2 EURUSD,M1: market info MODE_SPREAD:22

.

See why is vital to KNOW what you send to a function?

There are issues here - how find out? Is simple = Print()

Any expression, any value - whatever, that is touched by Point maybe incorrect - same for any stuff, yes?

Your Print() output will tell you cuz you will manually do calculation ASIF Point or whatever, is as expected. Then you see that your calc is <> output, yes? Then you can start going deeper into WHY your calc and output not same - can even be that it is your calc that is faulty! and code ok...

.

use Print() everywhere! Not be cautious, have issue and must solve, yes?

.

I used EXACTLY same code line you posted for OrderSend() BUT I had to set lots by: double lots=0.01;
.

 

Hello,


I put 5 digits for the print it is better, so there is values in MODE_POINT.

I didn't put the print() for the ordersend() because there is simple values in it for the example.

I put you the ordersend() line :


int ticket=OrderSend("EURUSD",OP_SELL,1,Bid,3,1.50,1.30,"SHORT",0,0,Red);

if (ticket<0)

{

Print("OrderSend failed with error #",GetLastError());

return(0);

}

____

I precise again that when I use OP_SELLLIMIT (with a limit price instead of the "Bid") in OrderSend() instead of OP_SELL, it works

So this work :

int ticket=OrderSend("EURUSD", OP_SELLLIMIT,1,limit_price,3,1.50,1.30,"SHORT",0,0,Red);

if (ticket<0)

{

Print("OrderSend failed with error #",GetLastError());

return(0);

}

____


16:34:48 Compiling 'test2'

16:34:48 test2 EURUSD,M1: deinitialized
16:34:48 test2 EURUSD,M1: uninit reason 2
16:34:48 test2 EURUSD,M1: loaded successfully
16:34:48 test2 EURUSD,M1: initialized
16:34:51 test2 EURUSD,M1: MODE_LOW :1.38774
16:34:51 test2 EURUSD,M1: MODE_HIGH :1.40243
16:34:51 test2 EURUSD,M1: MODE_TIME :1247240084.00000
16:34:51 test2 EURUSD,M1: MODE_BID :1.39417
16:34:51 test2 EURUSD,M1: MODE_ASK :1.39440
16:34:51 test2 EURUSD,M1: MODE_POINT :0.00001
16:34:51 test2 EURUSD,M1: MODE_DIGITS :5.00000
16:34:51 test2 EURUSD,M1: MODE_SPREAD :23.00000
16:34:51 test2 EURUSD,M1: MODE_STOPLEVEL :0.00000
16:34:51 test2 EURUSD,M1: MODE_LOTSIZE :100000.00000
16:34:51 test2 EURUSD,M1: MODE_TICKVALUE :1.00000
16:34:51 test2 EURUSD,M1: MODE_TICKSIZE :0.00001
16:34:51 test2 EURUSD,M1: MODE_SWAPLONG :-5.00000
16:34:51 test2 EURUSD,M1: MODE_SWAPSHORT :-5.00000
16:34:51 test2 EURUSD,M1: MODE_STARTING :0.00000
16:34:51 test2 EURUSD,M1: MODE_EXPIRATION :0.00000
16:34:51 test2 EURUSD,M1: MODE_TRADEALLOWED :1.00000
16:34:51 test2 EURUSD,M1: MODE_MINLOT :0.10000
16:34:51 test2 EURUSD,M1: MODE_LOTSTEP :0.10000
16:34:51 test2 EURUSD,M1: MODE_MAXLOT :100.00000
16:34:51 test2 EURUSD,M1: MODE_SWAPTYPE :1.00000
16:34:51 test2 EURUSD,M1: MODE_PROFITCALCMODE :0.00000
16:34:51 test2 EURUSD,M1: MODE_MARGINCALCMODE :0.00000
16:34:51 test2 EURUSD,M1: MODE_MARGININIT :100000.00000
16:34:51 test2 EURUSD,M1: MODE_MARGINMAINTENANCE :100000.00000
16:34:51 test2 EURUSD,M1: MODE_MARGINHEDGED :50000.00000
16:34:51 test2 EURUSD,M1: MODE_MARGINREQUIRED :500.00000
16:34:51 test2 EURUSD,M1: MODE_FREEZELEVEL :0.00000

16:34:51 test2 EURUSD,M1: OrderSend failed with error #130


I really don't understand at all :$.

Reason: