It's in the documentation:
At placing of a pending order, the open price cannot be too close to the market.
The minimal distance of the pending price from the current market one in points
can be obtained using the MarketInfo()
function with the MODE_STOPLEVEL parameter. In case of false open price of a
pending order, the error 130
(ERR_INVALID_STOPS) will be generated.
So you would use the 2 in combination though you'll need to account for some slippage as well
double minDistance = ((MarketInfo(Symbol(),MODE_STOPLEVEL)+MarketInfo(Symbol(),MODE_SPREAD)*MarketInfo(Symbol(),MODE_POINT)); //If pending above market price double price = MarketInfo(Symbol(),MODE_ASK)+minDistance; //Else pending below market price double price = MarketInfo(Symbol(),MODE_BID)-minDistance;
That should work though I've not compiled it yet.
in case of pending orders
open price must differ from market price by at least unknown pips
how can i calculate this unknown variable ?
for example to calculate Last incoming ask price
Thank You in Advance
Dear heelflip thank you so much
Dear dabbler I get your meaning thank you so much
in case of pending orders
open price must differ from market price by at least unknown pips
how can i calculate this unknown variable ?
for example to calculate Last incoming ask price
Thank You in Advance
Dear RaptorkUK it's helpful for me Thank you very much
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
in case of pending orders
open price must differ from market price by at least unknown pips
how can i calculate this unknown variable ?
for example to calculate Last incoming ask price
Thank You in Advance