pontuso:
Did you read the OrderOpenPrice() documentation ? where it says . . . "Order must be first selected by the OrderSelect() function." ?
Hi
How do i get the OrderOpenprice (), when backtesting.
I have tried with this
And it gives me right price sometimes but not always?
Hi again
This is working correct in backtester and giving me the right results.! =)
Just wanna check with you that this is the proper way of writing it
OrderSelect(0,SELECT_BY_POS,MODE_TRADES); double open = OrderOpenPrice();
- What are Function return values ? How do I use them ? - MQL4 forum (what if there is no open order?)
- Do a orderSelect loop (what if order position zero is from another chart?)
- Filter by magic number (what if order is from another EA or manual trading)
- Do it right
I think i got it now.
{ for(int op=0; op<OrdersTotal();op++) // Loop through orders if(OrderSelect(op,SELECT_BY_POS,MODE_TRADES)==true && OrderMagicNumber()==Magic) // Select the correct order from my magic number double openprice = OrderOpenPrice(); // Gives me the OrderOpenPrice value on this EA:s last open order }

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
How do i get the OrderOpenprice (), when backtesting.
I have tried with this
double open = OrderOpenPrice();
And it gives me right price sometimes but not always?