blouf:
Hi, did you try POSITION_PRICE_CURRENT ?
Hi there,
If i open a long at x1, x2, x3, i can see in the trade tab that the price change. How to return this value in mql5 ?
POSITION_PRICE_OPEN returns only the initial buying price.
Thanks
Malacarne:
Hi, did you try POSITION_PRICE_CURRENT ?
Yes it's the current price (ask/bid)
Hi, did you try POSITION_PRICE_CURRENT ?
Well, if you're using MT5 the current position price can be retrieved with POSITION_PRICE_OPEN. Are you using MT5 or MT4 ?
Malacarne:
Well, if you're using MT5 the current position price can be retrieved with POSITION_PRICE_OPEN. Are you using MT5 or MT4 ?
MT5, but once again, PRICE_OPEN get the result of the initial buying order only
Well, if you're using MT5 the current position price can be retrieved with POSITION_PRICE_OPEN. Are you using MT5 or MT4 ?
Not at all. POSITION_PRICE_OPEN gives you the average price, not the initial open price. Please check it.
Please try this:
//--- GLOBALS double avgPrice; //--- Inside OnTick, OnTimer or OnCalculate if(PositionSelect(_Symbol)) { avgPrice = PositionGetDouble(POSITION_PRICE_OPEN); } //--- Print("avgPrice = ",DoubleToString(avgPrice,_Digits));
And tell us what you get.
Malacarne:
You have to better describe this function...
You have to better describe this function...
void Sell() { double Bid = SymbolInfoDouble(Symbol(), SYMBOL_BID); Trade.PositionOpen(_Symbol, ORDER_TYPE_SELL, Lots, Bid, 0, 0, OrderComment); }
I want to call it from another function and be allowed to pass how much lot i want : Sell(0.01);
EDIT : if no param use a default value

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 there,
If i open a long at x1, x2, x3, i can see in the trade tab that the price change. How to return this value in mql5 ?
POSITION_PRICE_OPEN returns only the initial buying price.
Thanks