- OrderSelect() and OrderProfit() > 0
- OrderSelect() and int iBar = iBarShift(NULL,0, OrderCloseTime())
Hello,
I am working on an EA and am looking for a technique to do the following:
Before opening an order, I want to find the last time an order on the desired symbol was closed and get the following info:
1. Did it close in my favor.
2. What Bar did it close on or, does the current bar == the bar the order closed on.
If you know a technique, but don't have code, that is fine. I just need some pointers into the right direction.
Loop through the OrderHistory, find the newest Order that matches your symbol, OrderSelect it, Check it's OrderProfit(), check it's OrderCloseTime(), use iBarShift() to find the OrdrCloseTime() bar number, is it 0 ? Done.
Please read the documentation, Trading Functions & Timeseries access
Thanks,
ALso, WHRoeder, there is no need to make such jerkoff comments.
It is not always easy to sort out and find answers to obscure things like this when you are new and the documentation is extensive.
If this forum is not for asking questions and getting insight into the system, then what is it for?
lee
Thanks,
ALso, WHRoeder, there is no need to make such jerkoff comments.
It is not always easy to sort out and find answers to obscure things like this when you are new and the documentation is extensive.
If this forum is not for asking questions and getting insight into the system, then what is it for
It's also for saying "Thank you" when someone tries to help you and tries to help you hep yourself, helping yourself if the fastest way to get help.
What you asked is very far from obscure, it's basic Order History interrogation, if it were obscure you wouldn't have gotten 2 similar answers within 11 minutes of asking for help.
Hello,
Sorry if my 'Thanks' was not clear enough. I do appreciate the help.
If you are a programmer as well, then you must know what it is like trying to learn a new language. And especially one that requires so much specialized calls and functionality as MQL4 does.
If you look at it like this, then you surly can understand why something like the request above can be difficult to sort out for a newbie, but not someone who has been working with MQL4 for sometime like you and WHRoeder.
lee
Hello,
Sorry if my 'Thanks' was not clear enough. I do appreciate the help.
If you are a programmer as well, then you must know what it is like trying to learn a new language. And especially one that requires so much specialized calls and functionality as MQL4 does.
If you look at it like this, then you surly can understand why something like the request above can be difficult to sort out for a newbie, but not someone who has been working with MQL4 for sometime like you and WHRoeder.
Yes whroeder is usually rude and coincidentally the guy with the helmet who also happens to be a moderator usually backs him up
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
I am working on an EA and am looking for a technique to do the following:
Before opening an order, I want to find the last time an order on the desired symbol was closed and get the following info:
1. Did it close in my favor.
2. What Bar did it close on or, does the current bar == the bar the order closed on.
If you know a technique, but don't have code, that is fine. I just need some pointers into the right direction.
take care,
lee