hi, my intention is to create a StopLost by referring to existing account balance and doesn't seem to work with my existing code.
can some one advice what's wrong with the coding?
//define---------------
int risk = 20;
bool CountDeposite = ((1-(AccountFreeMargin()/AccountBalance()))*100) >= risk;
//closing tickets -----------------
if(OrderProfit()<0 && CountDeposite == true)
{
OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet); // close position
return(0); // exit
}
can some one advice what's wrong with the coding?
//define---------------
int risk = 20;
bool CountDeposite = ((1-(AccountFreeMargin()/AccountBalance()))*100) >= risk;
//closing tickets -----------------
if(OrderProfit()<0 && CountDeposite == true)
{
OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet); // close position
return(0); // exit
}