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.
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.
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
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
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.
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
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
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
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!
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
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?
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?
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
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

May 13 2013 at 07:40
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.
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.