How to open Buy position for the price no less than a price

 


Hello.

I would like ask a question .

First of all, please suppose a case that Ask price and Bid price are the same price
like the trade in a broker which offers the trade
with no spread and only paying a commission per order
(for example the trade in Broce investment limited .)

As long as I experienced on Demo trade,
when we send a instant order of which Openprice is different from the current market price by EA,
it seems that MT4 opens the position for the current market price
even if it is higher or lower than Openprice of the order .

For example,

When I send Buy order of which Openprice is 100.08 by EA when Market price is 100.10,
Buy position is opened at 100.10 .

Also when I send Buy order of which openprice is 100.12 by EA when Market price is 100.10,
Buy position is opened at 100.10 .

I would like to open a Buy position
for Openprice no less than Closeprice of a bar at a defined time .

For example if I define the time as 13:07 on 1 min chart,

when Closeprice of a bar in 13:07 is 100.60 on 1 min chart,

I want to open Buy position when the current market price is no less than 100.60
on a bar in 13:08 on the chart.

But if I coded like a following,

if(Ask <= Close[1])
OrderSend(Symbol(),0,1,Ask,0,0,0,NULL,0,0);

Buy position was opened for the price higher than " Close[1] "
in case that the market price asended quickly and got over Close[1]
after it became no less than Close[1] once .

I wonder
if it was because the market price asended quickly and got over Close[1]
after it became no less than Close[1] once
and MT4 opened a position for high price different from Openprice of the order
as I refered at first .


Anyone can suggest how to open Buy position
for the price no less than Close[1] certainly in this case ?

Please post your way .

 
market orders are more or less never guaranteed and you always loose more then spread (in your case >0). Pending orders would be your friend but you cannot send pending orders without having safety pip distance like 10-30pips (depending on provider). you cannot guarantee price but you may do something like if(Ask <= Close[1]-3*Point) so you can try to hit right price.
 

Thank you for posting .

Slippage and requote will be big troubles for many traders .

But I would like to think about a problem on this thread away with the problem .
Please suppose no slippage .

That is this is a broblem about how to execute by EA on MT4 .

If my position is opened for the price more profittable for me .
I can accept it of course .
But I don't hope to suffer from an unexpectable loss by reasons (exept for Slippage) .
"No less than " means such concept .

I would like to know what to do to realize it .

 
how to exlude broker spread n commission n close the trade in profit??
 
legendofcibola: how to exlude broker spread n commission n close the trade in profit??

Do you really think that a broker will allow something such that they will not get paid?

Reason: