you have to choose which order's open and close price first
after that you may work with order open price and close price
Ahmet Metin Yilmaz:
Thanks for your fast reply,you have to choose which order's open and close price first
after that you may work with order open price and close price
Would I use orderselect() or select() for that?
in your case,
OrderHistoryTotal() and OrderSelect()
https://docs.mql4.com/trading/ordershistorytotal
OrdersHistoryTotal - Trade Functions - MQL4 Reference
- docs.mql4.com
The number of closed orders in the account history loaded into the terminal. The history list size depends on the current settings of the "Account history" tab of the terminal.
Ahmet Metin Yilmaz:
Thanks so much. I'll give it a try now and update here if I get it working
in your case,
OrderHistoryTotal() and OrderSelect()
https://docs.mql4.com/trading/ordershistorytotal
EANOOB:
Thanks so much. I'll give it a try now and update here if I get it working
Thanks so much. I'll give it a try now and update here if I get it working
youre welcome :)
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
Hi everyone,
I know my question might be a bit stupid to those of you more experienced but I really need help with an issue I have run into.
I am reasonably new to coding, and I have been spending the past 4 hours looking through the forums and google for how to do this and I can't find an answer I can understand or that works for me.
I am trying to make a basic EA using the martingale where I check if the trade closed on the stop loss and if it did then to double the trade volume of the next trade, and if it closed on the take profit to reset the trade volume to
the original lower setting.
I have added this for buy orders and switched the > and < around for the sell order.
I'm not sure if PRICE_OPEN and PRICE_CLOSE are the right things to be comparing to find out if the trade was at a loss or profit.
Also, when I run this code in the EA, it only places one trade then stops.
Any help would be greatly appreciated. Sorry for coming across as a total newbie.