This seems like it should be the most basic simple thing and I have spents HOURS just trying to find out how to get the crrent price of an open order that is already selected.
Someone PLEASE help me!
The order open price is retrieved using OrderOpenPrice(). The current price is the Bid.
Excuse my incorrect usage of terminology.
I am not looking for the 'Opening Price' of a trade, but rather the CURRENT price of an ACTIVE trade.
I know that their is a simple, short statement that does exactly this because I found it a couple of days ago. But I can't remember it or find it now.
Looking at the definition for the 'OrderOpenPrice()' I don't see anything about either the 'Ask' or the 'Bid' price there and I'm afraid I'm too new to understand how I would get the current price with 'OrderOpenPrice()'
Regardless, thanks for posting.
Excuse my incorrect usage of terminology.
I am not looking for the 'Opening Price' of a trade, but rather the CURRENT price of an ACTIVE trade.
I know that their is a simple, short statement that does exactly this because I found it a couple of days ago. But I can't remember it or find it now.
Looking at the definition for the 'OrderOpenPrice()' I don't see anything about either the 'Ask' or the 'Bid' price there and I'm afraid I'm too new to understand how I would get the current price with 'OrderOpenPrice()'
Regardless, thanks for posting.
U mean OrderClosePrice():
- if the selected order is open - returns current closing price (which is not necessarily the actual price it would be closed at if u attempt closing it).
- if the selected order has already been closed - returns the actual price the order was closed.
Obviously, the order must be selected first, so it's only a 'short statement' if it was already selected...
Parameters:
Sample: double bid =MarketInfo("EURUSD",MODE_BID); double ask =MarketInfo("EURUSD",MODE_ASK); double point =MarketInfo("EURUSD",MODE_POINT); int digits=MarketInfo("EURUSD",MODE_DIGITS); int spread=MarketInfo("EURUSD",MODE_SPREAD); |
Market information identifiers, used with MarketInfo() function.
It can be any of the following values:
Constant | Value | Description |
---|---|---|
MODE_LOW | 1 | Low day price. |
MODE_HIGH | 2 | High day price. |
MODE_TIME | 5 | The last incoming tick time (last known server time). |
MODE_BID | 9 | Last incoming bid price. For the current symbol, it is stored in the predefined variable Bid |
MODE_ASK | 10 | Last incoming ask price. For the current symbol, it is stored in the predefined variable Ask |
MODE_POINT | 11 | Point size in the quote currency. For the current symbol, it is stored in the predefined variable Point |
MODE_DIGITS | 12 | Count of digits after decimal point in the symbol prices. For the current symbol, it is stored in the predefined variable Digits |
MODE_SPREAD | 13 | Spread value in points. |
MODE_STOPLEVEL | 14 | Stop level in points. |
MODE_LOTSIZE | 15 | Lot size in the base currency. |
MODE_TICKVALUE | 16 | Tick value in the deposit currency. |
MODE_TICKSIZE | 17 | Tick size in the quote currency. |
MODE_SWAPLONG | 18 | Swap of the long position. |
MODE_SWAPSHORT | 19 | Swap of the short position. |
MODE_STARTING | 20 | Market starting date (usually used for futures). |
MODE_EXPIRATION | 21 | Market expiration date (usually used for futures). |
MODE_TRADEALLOWED | 22 | Trade is allowed for the symbol. |
MODE_MINLOT | 23 | Minimum permitted amount of a lot. |
MODE_LOTSTEP | 24 | Step for changing lots. |
MODE_MAXLOT | 25 | Maximum permitted amount of a lot. |
MODE_SWAPTYPE | 26 | Swap calculation method. 0 - in points; 1 - in the symbol base currency; 2 - by interest; 3 - in the margin currency. |
MODE_PROFITCALCMODE | 27 | Profit calculation mode. 0 - Forex; 1 - CFD; 2 - Futures. |
MODE_MARGINCALCMODE | 28 | Margin calculation mode. 0 - Forex; 1 - CFD; 2 - Futures; 3 - CFD for indices. |
MODE_MARGININIT | 29 | Initial margin requirements for 1 lot. |
MODE_MARGINMAINTENANCE | 30 | Margin to maintain open positions calculated for 1 lot. |
MODE_MARGINHEDGED | 31 | Hedged margin calculated for 1 lot. |
MODE_MARGINREQUIRED | 32 | Free margin required to open 1 lot for buying. |
MODE_FREEZELEVEL | 33 | Order freeze level in points. If the execution price lies within the range defined by the freeze level, the order cannot be modified, cancelled or closed. |
Libraries use variables of the module that has called a library.
To have a safe and quick access to these data, client terminal provides local copies of predefined variables for each launched program separately. These data are updated at every launch of an attached expert or a custom indicator automatically or using the RefreshRates() function call.
To get the CURRENT price of an Active Trade:
double Point
Sample:
OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,Ask+TakeProfit*Point);
See also MarketInfo().
I don't understand what you are saying with this latest post. Point has nothing to do with the "current price of an active trade". Point returns (for example) 0.0001 for a 4 digit broker/symbol and 0.00001 for a 5 digit broker/symbol.
The reason that you can't find any reference to the "current price of an active trade" is because the current price IS NOT AN ATTRIBUTE OF a trade.
So as Gordon said, you can check the OrderClosePrice() of a selected order - which will fluctuate with the market until the order is closed.
Or you can check the OrderType() of the selected order and then check Bid or Ask as appropriate. (Or if the selected order is from another symbol, you can get the bid and ask prices using MarketInfo().
CB
Thanks - this post has helped me - even though I am not the origional poster.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
This seems like it should be the most basic simple thing and I have spents HOURS just trying to find out how to get the CURRENT price of an Active trade that is already selected.
Someone PLEASE help me!