Download MetaTrader 5

problem in taking order

To add comments, please log in or register
Michael Gad
227
Michael Gad 2015.04.19 11:37 

hello all

i am willing for some help to solve this issue.

i would like to take an order every  x pips  if the market continue in the same way of the first order

this is the code but it doesn't work with me , any help please 

double Xpips=50;

 if(Ask-Xpips*Point>=lastorderopenprice(OP_BUY)){ BUY=TRUE ;}
 
 if(Bid+Xpips*Point<=lastorderopenprice(OP_SELL)){ SELL=TRUE ;}

double lastorderopenprice(int type)

{
double lototo;
for(int i=0;i<=OrdersTotal();i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic&&OrderType()==type){
lototo=OrderOpenPrice();
}
}
return(lototo);
}
Michael Gad
227
Michael Gad 2015.04.28 01:30  
no one to help????
Keith Watford
Moderator
9640
Keith Watford 2015.04.28 04:17  

What doesn't work?

How do you know it doesn't work?

How can you be sure that your loop returns the last order of that type?

What does your function return if there is not an order open of the type? 

To add comments, please log in or register