problem in taking order

Back to topics list To post a new topic, please log in or register
avatar
12
micoul81 2015.04.19 13: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);
}
avatar
12
micoul81 2015.04.28 03:30 #
 
no one to help????
avatar
Moderator
3404
GumRai 2015.04.28 06: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? 

Back to topics list  

To add comments, please log in or register