![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
No I'm closing sell positions also, why do you ask?
Not here. Only the buys:
Also
is easily wrong if you use 5 digits broker (0.7 pips?). Also use predefined var Ask instead of bid to avoid requotes.
Why are you not checking if OrderClose() was success?
I've fixed it now, I think it's because I used Orderselect way too many times, even more than raptor thought, because I had it as both a primary and secondary condition, (it was carried over from the previous coding arrangement that I had built but I didn't realise the implications of doing it in this way)
Could you please check if this is just duck tape are an actual structural improvement.
Not here. Only the buys:
Also
is easily wrong if you use 5 digits broker (0.7 pips?). Also use predefined var Ask instead of bid to avoid requotes.
Why are you not checking if OrderClose() was success?
Tbh, I'm a bit new at mql4, I mean I've been writing in mql4 pretty much non stop day and night since mid december, and I've built a few EAs, currently I'm working on an indicator, never the less I have not yet developed habits like checking if the close was successful, nor am I familiar with *var Ask", is that the same as "Ask", were you just saying "the predefined variable, Ask"? In any case, I wanted to clear up a few of the errors I'm my current EA before I work on the indicator while learning more about mql4.
This will not work for sure.
OrderClosePrice() is for closed orders out of history pool.
Read the manual, you are doing everything wrong.
Tbh, I'm a bit new at mql4, I mean I've been writing in mql4 pretty much non stop day and night since mid december, and I've built a few EAs, currently I'm working on an indicator, never the less I have not yet developed habits like checking if the close was successful, nor am I familiar with *var Ask", is that the same as "Ask", were you just saying "the predefined variable, Ask"? In any case, I wanted to clear up a few of the errors I'm my current EA before I work on the indicator while learning more about mql4.
OK, you are new, so take time. You must check every step as you made mistakes almost everywhere.
Just select keywords, press F1 and read. Examples are everywhere.
Ask is predefined just like Bid, Point, Digits etc.
This will not work for sure.
OrderClosePrice() is for closed orders out of history pool.
Read the manual, you are doing everything wrong.
Not just for closed Orders . . . it will work.
Read all of this thread for more info: https://www.mql5.com/en/forum/143495
This will not work for sure.
OrderClosePrice() is for closed orders out of history pool.
Read the manual, you are doing everything wrong.
Woops I put that in there because of an earlier suggestion, it was initially bid, (bid = MarketInfo(ect)), it seems to be working atm but I can change back.
You MUST get into the habit of checking the return values from your trading functions, they tell you if they worked or not, if they didn't work you can then print all the variables involved and with that information be in the best position to understand what went wrong. It's critical in live or demo where you can't turn the clock back . . . read this: What are Function return values ? How do I use them ?
That's pure luck. Haven't checked it in code, but you cannot conclude it out of manual and it is not logical.
Also what value will you get from ECN broker? How will the slippage be calculated then, i.e. what is the use of slippage in this case?
That's pure luck. Haven't checked it in code, but you cannot conclude it out of manual and it is not logical.
Also what value will you get from ECN broker? How will the slippage be calculated then?