martingale - checking if position closed at a loss
you have to choose which order's open and close price first
after that you may work with order open price and close price
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
- docs.mql4.com
in your case,
OrderHistoryTotal() and OrderSelect()
https://docs.mql4.com/trading/ordershistorytotal
Thanks so much. I'll give it a try now and update here if I get it working
youre welcome :)
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.