getting "OrderSend error 130" all the time!

 

I'm trying to run several EA's on historical data and keep getting "OrderSend error 130" for both BUY and SELL orders without any logic.

It happens on most signals and I downloaded 10 different public domain EAs and none work on most signals at different resolutions (1M, 1H 4H..).


I'm well aware of what the error means and i'm an experienced programmer i'm sure i'm passing correct values for stop-loss and take-profit.


I use the metatrader software downloaded from FxPro broker.


The Stop-Level parameter is always set to 100 under "Symbol Properties" of most symbols which sounds like a lot compared to their advertised spread! but even when i change the stop-loss take-profit parameters passed by OrderSend, to something bigger than 100 it doesnt matter. I always get this dreaded Error 130



Please help

 
ls129:

I'm trying to run several EA's on historical data and keep getting "OrderSend error 130" for both BUY and SELL orders without any logic.

It happens on most signals and I downloaded 10 different public domain EAs and none work on most signals at different resolutions (1M, 1H 4H..).


I'm well aware of what the error means and i'm an experienced programmer i'm sure i'm passing correct values for stop-loss and take-profit.


I use the metatrader software downloaded from FxPro broker.


The Stop-Level parameter is always set to 100 under "Symbol Properties" of most symbols which sounds like a lot compared to their advertised spread! but even when i change the stop-loss take-profit parameters passed by OrderSend, to something bigger than 100 it doesnt matter. I always get this dreaded Error 130



Please help




I downloaded the metatrader software from Alpari and my EA and the downloaded ones seem to works.

10 hours wasted thanks to FxPro!

 
FxPro have one digit more than the others, you need to multiply your SL and TP with 10.
 
devilian1899:
FxPro have one digit more than the others, you need to multiply your SL and TP with 10.

thanks for that!


Do you mean that they standardize on 1/10 of a pip (ie: 6 digit resolution rather than 5)?

can you show an example of calculating stop-loss that would work with FxPro and with Alpari?

Maybe i'm missing something but it seems that the standard examples and documentation for mql4 won't work with FxPro..

 

Hello Im trying the example from the mql book:

And it continues to give me the error 130, independingly of the value I pass (and I tried near all studd)


Please help us as we seem to have the same problem.


I use FXCM DEMO and IBFX DEMO, both 5 digits broker.

OrderSend(Symbol(),OP_BUY,0.1,Ask,3,Bid-15*Point,Bid+15*Point);

 
I use FXCM DEMO and IBFX DEMO, both 5 digits broker.

Most brokers the minimum TP/SL distance is 3 pips, 30 points (MarketInfo(Symbol(), MODE_STOPLEVEL)*Point) you're using 1.5 pips.

  1. On ECN brokers, you must order send and then set the TP, SL
  2. On 5 digit brokers you must adjust TP, SL, AND slippage
    //++++ These are adjusted for 5 digit brokers.
    double  pips2points,    // slippage  3 pips    3=points    30=points
            pips2dbl;       // Stoploss 15 pips    0.0015      0.00150
    int     Digits.pips;    // DoubleToStr(dbl/pips2dbl, Digits.pips)
    int     init(){
        if (Digits == 5 || Digits == 3){    // Adjust for five (5) digit brokers.
                    pips2dbl    = Point*10; pips2points = 10;   Digits.pips = 1;
        } else {    pips2dbl    = Point;    pips2points =  1;   Digits.pips = 0; }
        // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl
    

 

I find this all to be much easier and more profitable when SL and TP are not set in terms of pips. I use variables I call stopK and profitK, and apply them as multiples of ATR for my SL and TP levels. This has 2 advantages:

1) SL and TP are defined in terms of market conditions instead of arbitrary risk tolerance rules.

2) This method works regardless of your broker and you can leave out pip2point conversions.

If you are someone that adheres to the 2% rule, this method makes position sizing a little trickier. If you ask me, risk should not be managed in terms of some percentage of your account size. Risk should be managed by developing a sound trading strategy, and then applying it to multiple negatively correlated currency pairs. But I digress!

 
Anomalous:

If you are someone that adheres to the 2% rule, this method makes position sizing a little trickier. If you ask me, risk should not be managed in terms of some percentage of your account size. Risk should be managed by developing a sound trading strategy, and then applying it to multiple negatively correlated currency pairs. But I digress!


Have you come accross the Kelly formula for working out the percentage of Bank to risk on a gamble?
 

Re the 130 Error on stoploss checking

for buy

if ( (Entry<Bid) && (Bid-Entry>Spread) ) {// ok to send order
}

for sell

if ( (Entry>Ask) && (Entry-Ask>Spread) ) {
  //ok to send order
}

The StopLevel in MarketInfo is 0 in my tester.

Take profit values should be greater than spread too.

 

Have you come across the Kelly formula for working out the percentage of Bank to risk on a gamble?
I had not until now. I read up on it though, thanks for the tip. ;)
Reason: