You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
All i did was adding that Res parameter and putting the Res= in front of OrderSend (got the idea from one of the expertes mt4 has built in)
Bad habit to get into.
will NOT make the OrderSend() magically succeed whereas before it failed. All it will do is stop the compiler from warning you that it should be checked.
There is a reason for this warning, so check it. Print all details should the OrderSend() return -1, then you may be able to pinpoint the problem.
After OrderSend, you should check GetLastError. MT4 will rarely show errors unless you have told it to show them.
if your code continue to open 0 orders, you need to print your errors to alert window, or to your journal, so that you can research that error.
After OrderSend, you should check GetLastError. MT4 will rarely show errors unless you have told it to show them.
if your code continue to open 0 orders, you need to print your errors to alert window, or to your journal, so that you can research that error.
You should check GetLastError() only if the OrderSend() returns -1.
Bad habit to get into.
will NOT make the OrderSend() magically succeed whereas before it failed. All it will do is stop the compiler from warning you that it should be checked.
Oh, ok Keith, i get what you are saying, I was getting that warning you told me, that Order send return should be checked (something like that) i really didnt even know what that Res command did, just saw it on another EA mt4 has built in and thought maybe it was what my EA was missing...
You are adding and subtracting 15 from your MA values, you want to add/subtract 15 points, so 15*_Point
That is very different. The same rule apply for TP/SL.
Your code need to look like this:
In addition to this, always check OrderSend result in a boolean function, and if the function return FALSE, GetLastError().
You can find a lot of good examples on CodeBase.
OrderSend() is not a boolean function.
It returns the ticket number in case it succeeds and otherwise -1;
OrderSend() is not a boolean function.
It returns the ticket number in case it succeeds and otherwise -1;
You are adding and subtracting 15 from your MA values, you want to add/subtract 15 points, so 15*_Point
That is very different. The same rule apply for TP/SL.
Your code need to look like this:
In addition to this, always check OrderSend result in a boolean function, and if the function return FALSE, GetLastError().
You can find a lot of good examples on CodeBase.
Thanks Fabio, this was really helpful, i saw some tutorials about changing ticks size ald lot size and found it a little confusing, thanks!!
OrderSend() is not a boolean function.
It returns the ticket number in case it succeeds and otherwise -1;
I woulnd`t know how to code such return, promise to get on it tho! thanks