- Help you with what? You haven't stated a problem. Show us your attempt
(using CODE button) and state
the nature of your problem.
No free help
urgent help. - OrderSelect loop through your orders. Find the one with the earliest OrderOpenPrice and remember it's profit.
-
Using OrdersTotal directly and/or no Magic number filtering on your
OrderSelect loop means your code is incompatible with every EA (including itself on other charts and manual
trading.)
Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 and MetaTrader 4 - MQL4 programming forum
I tried this and it lokks like it works.
double FindProfitOfFirstOrder(int dir) { double Profit = 0; datetime EarliestOrder = D'2099/12/31'; for (int i = 0; i < OrdersTotal(); i++) { if (OrderSelect(i, SELECT_BY_POS)) { if (OrderType() == dir) { if (EarliestOrder > OrderOpenTime()) { EarliestOrder = OrderOpenTime(); Profit = OrderProfit(); } } } } return (Profit); }
I had a Function, who give the FirstOrderOpenPrice, I changed Profit and Price, and so it gave me the Profit of the FirstOrder.
Or is something wrong? Or is there a better way?

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 everone,
I have a Question. I need the OrderProfit() of the first open Trade of the Buys and also of the Sells.
But I have no Idea, how to program this.
Can somebody help me?
bye,
tom