Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
I am trying to limit my orders based on my available equity. Can anyone see what i am doing wrong?
***************************************************
//---- input parameters
extern bool ShortOnly = true;
extern bool BuyOnly = true;
extern int TakeProfit = 20;
extern int ScaleTradeEntry = 10;
extern double Risk = 0.1;
extern int MinPercentMargin = 500;
extern double Key = 0;
***************************************************
//---- go trading only for first tick of new bar
// if(Volume[0]>1) return;
if (AccountMargin() != 0)
{
if (AccountEquity()/AccountMargin() < MinPercentMargin*0. 01)
{
Print("Trading suspended: Not enough Margin Left");
return;
}
}