Please use this to post code . . . it makes it easier to read.
Why are you using Leverage in your calculation ? leverage governs you margin requirement, why are you using to calculate your position size . . . perhaps you can explain the thinking behind your position size calculation ?
all i tried to do is to work out the account balance and then place a trade % according to it
i am new to codeing
do you have a standard script that you use for your EA or is it different for each EA
delcor:
Before you code anything you need to know what you are coding . . . . what are you trying to code ? can you write your equation in words ?
all i tried to do is to work out the account balance and then place a trade % according to it
i am new to codeing
what i need to work out is how much i want to risk
so risk =%
if i want to risk 5% of my account. i want the EA to work out how much i can trade. if balance increase so must the size increase
yes
it is set at 60
delcor:
if i want to risk 5% of my account.
Contract Size - MQL4 forum
if i want to risk 5% of my account.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
need help please
i have tried to add mm to my ea and also to increase the lots as it trade
but it does not do that can some one help me please
extern bool MM=true; //money managementextern double Risk=10; //risk in percentage
extern double Lots=0.06;
extern double Slippage = 3;
//In bars. How many bars to wait before entering a new position.
extern int RandomEntryPeriod = 100;
extern int StopLoss = 60;
extern int TakeProfit = 250;
extern int MaxPositions = 5;
the i use this to check the platform
double Poin=0;// double MML=0;
int init()
{
//Checking for unconvetional Point digits number
if (Point == 0.00001) Poin = 0.0001; //5 digits
else if (Point == 0.001) Poin = 0.01; //3 digits
else Poin = Point; //Normal
Magic = Period()+1339005;
return(0);
}
this is my mm
// expert money managementif(MM){if(Risk<0.1||Risk>100){Comment("Invalid Risk Value.");return(0);}
else{Poin=MathFloor((AccountFreeMargin()*AccountLeverage()*Risk*Point*100)/(Ask*MarketInfo(Symbol(),MODE_LOTSIZE)*MarketInfo(Symbol(),MODE_MINLOT)))*MarketInfo(Symbol(),MODE_MINLOT);}}
if(MM==false){Poin=Lots;}
to place a trade
int result = OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,Ask-StopLoss*Poin,Ask+TakeProfit*Poin,"gimic",Magic,0,clOpenBuy);if (result == -1)
int result = OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,Bid+StopLoss*Poin,Bid-TakeProfit*Poin,"gimic",Magic,0,clOpenSell);if (result == -1)