Your code is wrong..
In case of erro ticket is -1
Returns number of the ticket assigned to the order by the trade server or -1 if it fails.
I also have problem where one EA works for certain broker but not for other broker. It can be lot problem, spread problem, currency pair problem, etc as the list can keep going on.
However, for me, the only problem that I manage to catch is the digit (dot after zero) problem and currency pair symbol used problem. I fix it and it works again.
I have the following code in place, so the problem should not be spread or digits.
if (Digits == 5||Digits == 3)
pt = 10*Point;
else
pt = Point;
slip = MathCeil((Ask - Bid)/pt);
Dear all,
I am learning the basics of programming with mql4 via online courses, but i am stuck somewhere and cant find a solution to my problem. As it is fundamental for my further programming, I really hope somebody can help me.
I am practicing with new formulas and for the OrderSend code, it seems like it doesnt work for me.
I put in my script:
OrderSend(NULL, OP_BUYLIMIT, 0.01, Ask, 10, 1.08050, 1.08345);
When I apply this script to my actual chart, nothing happens... except in my experts tab I get the message (see in file)
I would really appreciate some help of an experienced programmer or someone with more knowledge about this. Thanks a lot in advance, stay home stay safe ! :)
I would really appreciate some help of an experienced programmer or someone with more knowledge about this. Thanks a lot in advance, stay home stay safe ! :)
Please use the code button (Alt+S) when posting code. Please edit your post.
OrderSend(NULL, OP_BUYLIMIT, 0.01, Ask, 10, 1.08050, 1.08345);
You cannot place a buy limit order at Ask, it must be lower than Ask.
Always check the result of the OrderSend() and print out the errors.
Do not double post!
I have deleted your topic which is a duplicate of your post here.
- Don't use NULL.
- You can use NULL in place of _Symbol only in those calls that the documentation specially says you can. iHigh does, iCustom does, MarketInfo does not. OrderSenddoes not.
- Don't use NULL (except for pointers where you explicitly check for it.) Use _Symbol and _Period, that is minimalist as possible and more efficient.
- Zero is the same as PERIOD_CURRENT which means _Period. Don't hard code numbers.
- MT4: No need for a function call with iHigh(NULL,0,s) just use the predefined arrays, i.e. High[].
- You can't move stops (or pending prices) closer to the market than the minimum: MODE_STOPLEVEL * _Point
or SymbolInfoInteger(SYMBOL_TRADE_STOPS_LEVEL).
Requirements and Limitations in Making Trades - Appendixes - MQL4 TutorialOn some ECN type brokers the value might be zero (broker doesn't know.) Use a minimum of two (2) PIPs.
- Please do not post an image of code or the editor — it is generally too small to be read.
Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum
Messages Editor
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
The same EA works fine on Instaforex and ICMarkets. but it does not work when I attached the EA to the charts of BTG MT4. I put a Print just before OrderSend() function, the print message shows buy/sell signals are generated as expected, but the OrderSend() mysteriously stops working. Autotrade is enabled. the broker confirmed there is no problem at his end. Could this be a bug?