maximal drawdown

 
i have an ea but i want to stop the maximal drwdon in % so i need a stoppoutpct! I copyied it from another ea but it doesn't work for my ea so i use the script - can anybody told me how i can use it
 

if((Balance.peak-Equity)/(Balance.peak/100)>=9){

//stopout

}

 

'Balance.peak' - variable not defined

'Equity' - variable not defined


What can i do=


Thanks for the fast answer! if the drawdown is over 15percent all orders should be closed! maybe with the magic number!

extern double StopLossPct = 100.0;

if ((100 - StopLossPct) * AccountBalance() / 100.0 >= AccountEquity())

 

this works but it does not close the trades ?stoplosspct can be unique all orders have the same magic number

if ((100 - StopLossPct) * AccountBalance() / 100.0 >= AccountEquity()){

//stopout

}

}
 
if ((100 - StopLossPct) * AccountBalance() / 100.0 >= AccountEquity()){

OrderClose(OrderTicket(), OrderLots(), Ask, 5);

}


why does it not close`` i tried everything

 
Have you selected the order previously?
 
if ((20) * AccountBalance() / 100.0 >= AccountEquity())
OrderSelect(1, SELECT_BY_POS);
OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet);
Reason: