# MT4 Language --&gt; SOMEONE in this forum is able to improve this code in this way???

114318

Hi to all!

My name's Luca;

I've got a big problem;

HMA EA works well but I have to put it on a CENT account;

My cent account has a limit -broker limit- of 100 lots for each order, in cent account 100 lots = 1 standard lot = 100000 usd

So can you change in "hma ea.mq4" the maximun lot for each order to 80 lots and if the order need to be bigger, the ea will place an order for the difference?
Someone is able to do that?

ex.1 for order of 153,6 lots it will place:
1 order of 8 lots
and 1 order of 73,6 lots

ex.2 for order of 307,2 lots it will place:
3 orders of 80 lots
and 1 order of 67,20 lots

ex.3 for order of 1024 lots it will place:
12 orders of 80 lots
and 1 order of 64 lots

ex.4 for order of 204,80 lots it will place:
2 orders of 80 lots
and 1 order of 44,80 lots

As you can see this is the problem:

Also starting from 0.03 lots the problem is the same:

I have made a lot of attempts, but without results,

I don't understand the code, but i've tried to change it as below:

void OpenMarketOrders(){
int cnt=0;
if (myOrderType==1 && ContinueOpening) {
if ((Bid-LastPrice)>=Pips*pt || OpenOrders<1) {
SellPrice=Bid;
LastPrice=0;
if (iTakeProfit==0) { tp=0; }
else { tp=SellPrice-iTakeProfit*pt; }
if (StopLoss==0) { sl=0; }
else { sl=SellPrice+StopLoss*pt; }
if (OpenOrders!=0) {
mylotsi=lotsi;
for(cnt=0;cnt<OpenOrders;cnt++){
else { mylotsi=NormalizeDouble(mylotsi*multiply,2); }
}
} else { mylotsi=lotsi; }
if(mylotsi>80 && mylotsi<=160){
}
if(mylotsi>160 && mylotsi<=240){
}
if(mylotsi>240 && mylotsi<=320){
}
if(mylotsi>320 && mylotsi<400){
}
if(mylotsi>=400 && mylotsi<480){
}
if(mylotsi>=480 && mylotsi<560){
}
if(mylotsi>=560 && mylotsi<640){
}
if(mylotsi>=640 && mylotsi<720){
}
if(mylotsi>=720 && mylotsi<800){
}

return(0);
}
}

The result is below:

My email is:

x823x@email.it

Thanks :)

Files:
114318

Thsi is also the indicator needed for backtests
Files: