help fineturn EA - page 2

 
delcor wrote >>

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

 
ronaldosim:

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

 
delcor:

show me please

or send me your EA

it give me an error

Function "CalculateCurrentOrders" is not referenced and will be removed from exp-file
 
delcor wrote >>

it give me an error

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

 
delcor wrote >>

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

 
ronaldosim:

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);
}
 
delcor wrote >>

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)

 
ronaldosim:

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

 
delcor:

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;

Reason: