Function "CalculateCurrentOrders" is not referenced and will be removed from exp-file
just ignore this error; all it is saying is you have a function called CalculateCurrentOrders which you are not using; so either u delete it or levea; it will not cause any harm; the system is saying that is will remove this function from your compiled file ex4
under the function LotOptimization change your code to something like this
lot=lot*MulltiplyingFactor*losses
where MulitplyFactor = 2 or 3 or 4 etc, similar to your DecreaseFactor which is to decrease yr lot sizes as kosses mount
having said that, increasing yr lot size as losses increased is dangerous to yr EA, so use with care
do you mean something like this
//+------------------------------------------------------------------+ //| Calculate optimal lot size | //+------------------------------------------------------------------+ double LotsOptimized() { double lot=Lots*Multiplying*losses; int orders=HistoryTotal(); // history orders total int losses=0; // number of losses orders without a break //---- select lot size lot=NormalizeDouble(AccountFreeMargin()*MaximumRisk/1000.0,1); //---- calcuulate number of losses orders without a break if(DecreaseFactor>0) { for(int i=orders-1;i>=0;i--) { if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==false) { Print("Error in history!"); break; } if(OrderSymbol()!=Symbol() || OrderType()>OP_SELL) continue; //---- if(OrderProfit()>0) break; if(OrderProfit()<0) losses++; } if(losses>1) lot=NormalizeDouble(lot-lot*losses/DecreaseFactor,1); } //---- return lot size if(lot<0.1) lot=0.1; return(lot); }
//+------------------------------------------------------------------+ //| Calculate optimal lot size | //+------------------------------------------------------------------+ double LotsOptimized() { double lot=Lots*Multiplying*losses; int orders=HistoryTotal(); // history orders total int losses=0; // number of losses orders without a break //---- select lot size lot=NormalizeDouble(AccountFreeMargin()*MaximumRisk/1000.0,1); //---- calcuulate number of losses orders without a break if(DecreaseFactor>0) { for(int i=orders-1;i>=0;i--) { if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==false) { Print("Error in history!"); break; } if(OrderSymbol()!=Symbol() || OrderType()>OP_SELL) continue; //---- if(OrderProfit()>0) break; if(OrderProfit()<0) losses++; } if(losses>1) lot=NormalizeDouble(Lots*Multiplying*losses;,1);} //---- return lot size if(lot<0.1) lot=0.1; return(lot); }
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.
tell me is there a test system on the EA programing to show you step for step what happens when this EA runs
no, there is no stepping ftn for testing ; use Print to display values for checking and various parts of yr programs
I like your code for the Lots Optimisation ; I tweaked it to increase lot volume as losses increases
I like your code for the Lots Optimisation ; I tweaked it to increase lot volume as losses increases
show me please
or send me your EA
show me please
or send me your EA
it give me an error
Function "CalculateCurrentOrders" is not referenced and will be removed from exp-fileit give me an error
Function "CalculateCurrentOrders" is not referenced and will be removed from exp-filejust ignore this error; all it is saying is you have a function called CalculateCurrentOrders which you are not using; so either u delete it or levea; it will not cause any harm; the system is saying that is will remove this function from your compiled file ex4
show me please
or send me your EA
under the function LotOptimization change your code to something like this
lot=lot*MulltiplyingFactor*losses
where MulitplyFactor = 2 or 3 or 4 etc, similar to your DecreaseFactor which is to decrease yr lot sizes as kosses mount
having said that, increasing yr lot size as losses increased is dangerous to yr EA, so use with care
under the function LotOptimization change your code to something like this
lot=lot*MulltiplyingFactor*losses
where MulitplyFactor = 2 or 3 or 4 etc, similar to your DecreaseFactor which is to decrease yr lot sizes as kosses mount
having said that, increasing yr lot size as losses increased is dangerous to yr EA, so use with care
do you mean something like this
//+------------------------------------------------------------------+//| Calculate optimal lot size |
//+------------------------------------------------------------------+
double LotsOptimized()
{
double lot=Lots*Multiplying*losses;
int orders=HistoryTotal(); // history orders total
int losses=0; // number of losses orders without a break
//---- select lot size
lot=NormalizeDouble(AccountFreeMargin()*MaximumRisk/1000.0,1);
//---- calcuulate number of losses orders without a break
if(DecreaseFactor>0)
{
for(int i=orders-1;i>=0;i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==false) { Print("Error in history!"); break; }
if(OrderSymbol()!=Symbol() || OrderType()>OP_SELL) continue;
//----
if(OrderProfit()>0) break;
if(OrderProfit()<0) losses++;
}
if(losses>1) lot=NormalizeDouble(lot-lot*losses/DecreaseFactor,1);
}
//---- return lot size
if(lot<0.1) lot=0.1;
return(lot);
}
do you mean something like this
//+------------------------------------------------------------------+
//| Calculate optimal lot size |
//+------------------------------------------------------------------+
double LotsOptimized()
{
double lot=Lots*Multiplying*losses;
int orders=HistoryTotal(); // history orders total
int losses=0; // number of losses orders without a break
//---- select lot size
lot=NormalizeDouble(AccountFreeMargin()*MaximumRisk/1000.0,1);
//---- calcuulate number of losses orders without a break
if(DecreaseFactor>0)
{
for(int i=orders-1;i>=0;i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==false) { Print("Error in history!"); break; }
if(OrderSymbol()!=Symbol() || OrderType()>OP_SELL) continue;
//----
if(OrderProfit()>0) break;
if(OrderProfit()<0) losses++;
}
if(losses>1) lot=NormalizeDouble(Lots*Multiplying*losses;,1);}
//---- return lot size
if(lot<0.1) lot=0.1;
return(lot);
}
no, put it after the if(losses>1)
no, put it after the if(losses>1)
it gives me an error
'Multiplying' - variable not defined C:\Program Files\Interbank FX Trader 4\experts\jbtest4.mq4 (57, 44)
where do i defined it
it gives me an error
'Multiplying' - variable not defined C:\Program Files\Interbank FX Trader 4\experts\jbtest4.mq4 (57, 44)
where do i defined it
ok i have int multiplying=2;