Download MetaTrader 5

MT4 Language --> SOMEONE in this forum is able to improve this code in this way???

To add comments, please log in or register
Do you need a trading robot? Orderit via Freelance service!
Forex Trader
114255
Forex Trader 2009.12.30 15:18 

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++){
if (MaxTrades>12) { mylotsi=NormalizeDouble(mylotsi*multiply,2); }
else { mylotsi=NormalizeDouble(mylotsi*multiply,2); }
}
} else { mylotsi=lotsi; }
if(mylotsi<=80)OrderSend(Symbol(),OP_BUY,mylotsi,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
if(mylotsi>80 && mylotsi<=160){
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,NormalizeDouble(mylotsi-80,1),NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
}
if(mylotsi>160 && mylotsi<=240){
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,NormalizeDouble(mylotsi-160,1),NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
}
if(mylotsi>240 && mylotsi<=320){
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,NormalizeDouble(mylotsi-240,1),NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
}
if(mylotsi>320 && mylotsi<400){
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,NormalizeDouble(mylotsi-320,1),NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
}
if(mylotsi>=400 && mylotsi<480){
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,NormalizeDouble(mylotsi-400,1),NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
}
if(mylotsi>=480 && mylotsi<560){
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,NormalizeDouble(mylotsi-480,1),NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
}
if(mylotsi>=560 && mylotsi<640){
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,NormalizeDouble(mylotsi-560.2,1),NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
}
if(mylotsi>=640 && mylotsi<720){
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,NormalizeDouble(mylotsi-640.2,1),NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
}
if(mylotsi>=720 && mylotsi<800){
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,80,NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
OrderSend(Symbol(),OP_BUY,NormalizeDouble(mylotsi-720,1),NormalizeDouble(BuyPrice,Digits),slippage*mt,sl,tp,"MyMEFx EA"+MagicNumber,MagicNumber,0,ArrowsColor);
}

return(0);
}
}






The result is below:






Someone can Help me please?



My email is:

x823x@email.it


Thanks :)



Forex Trader
114255
Forex Trader 2009.12.30 15:20  
Thsi is also the indicator needed for backtests
Files:
To add comments, please log in or register