To use chat, please login.
Back to contacts

Can't fix OrderSend error 130

tiiniz (tiiniz)
Apr 29 2013 at 20:05
14 posts
Hi,

I have a EA which is 50% automatic, 50% manual. So I am drawing manually trendlines and this EA is working according to these lines. That EA is not made by me, thats why I need some help with that. I tested this EA for last 6 months on demo account with poitive results, but with small profits. Finally I decided to try it on the real account. I tried Forex.com and Oanda MT4 platforms, but on both of them I got only OrderSend error 130. Of course everybody knows what is this problem about, but I am not so good with coding to fix it. I was wondering if there is somebody who can fix this EA (so it works for real accounts) for me and how much this can cost to me?

Thanks in a advance.

petays
May 02 2013 at 20:44
86 posts
tiiniz posted:
Of course everybody knows what is this problem about, but I am not so good with coding to fix it.


Just curious, what's the problem?
Is it Instant Execution vs. Market Execution?

Being Bearish or Bullish Makes No Difference
tiiniz (tiiniz)
May 02 2013 at 20:54
14 posts
petays posted:
tiiniz posted:
Of course everybody knows what is this problem about, but I am not so good with coding to fix it.


Just curious, what's the problem?
Is it Instant Execution vs. Market Execution?


Yes, you are right. I got some help from https://www.forex-tsd.com/forum.php forum, so I will try to recode that EA.

It simply has to be coded to work on ECN/STP like brokers. Which means : to open order with stop loss and take profit set to 0 and only when an order is opened modify to to desired stop loss and / or take profit

petays
May 02 2013 at 21:10
86 posts
Yeah, fixing that shouldn't be too difficult if you know what you are doing 😀
And some knowledge of programming is not bad if you plan to use a third party EA and have the source code available.

It would be interesting to see that part of your code where the EA checks if price crosses/touches your hand-drawn trendline(s).
I've been toying with similar ideas but calculations in price-time coordinates is not so simple (to me).
But it should be doable with some kind of averaging/approximation to convert time to price in every bar which your trendline goes over.
Then you can compare prices.

Being Bearish or Bullish Makes No Difference
tiiniz (tiiniz)
May 03 2013 at 16:49
14 posts
Yes, trying to fix this problem this way:
Original code:
li_ret_44 = OrderSend(Symbol(), OP_BUYLIMIT, a_lots_4, a_price_12, slip, StopLong(ad_20, ai_28), TakeLong(a_price_12, ai_32), a_comment_36, MagicNumber, 0, CLR_NONE);

Edited code:
li_ret_44 = OrderSend(Symbol(), OP_BUYLIMIT, a_lots_4, a_price_12, slip, 0, 0, a_comment_36, MagicNumber, 0, CLR_NONE);
if (li_ret_44>-1)
   OrderModify(li_ret_44,OrderOpenPrice(),StopLong(ad_20, ai_28), TakeLong(a_price_12, ai_32),0,CLR_NONE);

Shortly we gonna see whats happening.
You can take a look how it looks like while traiding by attached picture.

I am still trying to understand this code (its on 15 MS Word pages), so I am not really sure which is which part :D

Attachments:


petays
May 03 2013 at 17:17
86 posts
Your fix seems quite workable.
Maybe you should select order first by its ticket before using OrderOpenPrice() function?

Once i reverse-engineered code for one indicator to find out what formulas it was using.
It was not so bad when I started renaming all global variables first and then relevant local variables.
That helped me to have a better understanding of the code.
Luckily most MQL4 code is written quite straight forward manner so it should be easy to understand ;-)
Browsing the code in MetaEditor should help you because you get syntax highlighting that helps a lot.
Best luck!

Being Bearish or Bullish Makes No Difference
tiiniz (tiiniz)
May 03 2013 at 18:35
14 posts
Learning more and more with every day :) Now I am reading about SelectOrder function for example.
Do you think its enough with just one line like that? --->

Edited code:

li_ret_44 = OrderSend(Symbol(), OP_BUYLIMIT, a_lots_4, a_price_12, slip, 0, 0, a_comment_36, MagicNumber, 0, CLR_NONE);
OrderSelect(li_ret_44,SELECT_BY_TICKET);
if (li_ret_44>-1)
   OrderModify(li_ret_44,OrderOpenPrice(),StopLong(ad_20, ai_28), TakeLong(a_price_12, ai_32),0,CLR_NONE);

Or should I add new variable for orderselect?

petays
May 03 2013 at 19:25
86 posts
int ticket=OrderSend(TradeSymbol,OP_BUY,TradeLot,Ask,TradeSlippage,0,0,TradeComment,TradeMagicNumber,0,Green);
if(ticket>-1)
{
  OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES);
  OrderModify(ticket,OrderOpenPrice(),TradeStopLoss,TradeTakeProfit,0,Green);
}

See more: https://forum.mql4.com/36116

Being Bearish or Bullish Makes No Difference
PipGnostic
TheCyclist (TheCyclist)
May 13 2013 at 07:40
724 posts
ERR_INVALID_STOPS 130 Invalid stops.

The problem is on the stops. Make them 0 and it will most likely send.

Now in the case of O and any ECN you can't send orders with stops. Your orders will simply be rejected as is the case here. No point in looking for the problem. There isn't any. Just can't send with stops.

You have to modify them afterwords...!!

Send your oder, wait till it is set, then use ordermodify to add the stops.

CandleForex (CandleForex)
May 15 2013 at 01:49
36 posts
Did you manage to fix the error?

If not then we might look at it at no cost for you.
Go to https://MetaTraderProgramming.com and ask for a programmer to review it.

Please login to comment .