I try to use these code to manage my money,but an problem is I don't know how to descirbe my initital money(priniciple) .my method is cotrol lot :use priniciple 's maximumrisk+3 times about of profit(or loss)'s maximunrisk as lot,it profit>0,it will enlarge,otherwise,the vise.
but the first order's position still be 0.01(the mini lot of my MM terminal), these follow will be normal,don't know why. And I know the d==e in my code,so e/d always=1, but I wanna use d stands principal,but how do?TKS!
And have another method of lotoptimize,if solve this,I will list that one here!
MQL5:
double LotsOptimized() { double b,lot;//=Lots; int orders=HistoryTotal(); int losses=0,wins=0; int c,e,f,d; b=iATR(NULL,0,60,0); c=AccountLeverage(); d=AccountFreeMargin();//I wanna use it describe account's principal,but couldn't how to if(orders>=1) {e=AccountFreeMargin(); } Print(MarketInfo(Symbol(), MODE_LOTSIZE)); Print(MarketInfo(Symbol(), MODE_LOTSTEP)); Print(MarketInfo(Symbol(), MODE_MAXLOT)); Print("this accountleverage is",c); if(d!=0) lot=NormalizeDouble((e*MaximumRisk/2000)*(1+3*(e/d-1)),2);//if profitiable,increase position,otherwise,the vice if(lot<0.01) lot=0.01; return(lot); }
And have another method of lotoptimize,if solve this,I will list that one here!
Last edited by a moderator: