Experts: ComFracti - page 2

 

thanks - anice work- it runs very good on back test - but not on forvard . can you help ?

 
miemrich:


Hi Cosmicbeing, could you please share with me the parameter sets which you use to achieve such great results?

---------------

Hi all,



ComFracti v1 and ComFracti v2



Regarding my first tests for ComFracti that I posted - For some reason I did not save the settings with the great results. Ouch! I expected the STester report to show it as it normally shows the settings...and for some reason...this report did not. Oh well. So those settings disappeared and I tested some more.



I did get pretty good STester results with 3.0 - 5+ profit factors...with a few scary trades that could have squashed my account.

As Mich99 stated....this EA needs lots of testing.



I did run it on my Demo Account - mostly default settings - 2 week period. While it did end up with losses, I do see the potential with more optimizing...Results 10 Trades - 4 Wins - 6 Losses = -$167.17



I was going to post all the data but Mich99 has updated the program and time is better spent testing this new version.



With the new version, I got even better STester results - 5.0+ profit factors...but still the occasional losses. I will place this new version on a few charts and let it run for a week.



Further testing would be helped if we could display all the crossings and other strategy factors on the chart...to help us test, debug, and see exactly how close it's following the strategy.



Thanks again to Mich99 for the fun..and hopefully profitable...program. Good Luck and Good Trading To All!


Robert

 
gshavi:

thanks - anice work- it runs very good on back test - but not on forvard . can you help ?

Hi Avi :)

For optimization setings:    Maximal drawdown = 50%

                                       Consecutive los trades = 3.

Long time results: (1 year for comfracti_v2) 


settings: (copy & paste in notepad)

mn=65488
mn,F=0
mn,1=88
mn,2=0
mn,3=0
tp=500.00000000
tp,F=0
tp,1=2000.00000000
tp,2=0.00000000
tp,3=0.00000000
sl=1000.00000000
sl,F=0
sl,1=1000.00000000
sl,2=0.00000000
sl,3=0.00000000
TrailingStop=0.00000000
TrailingStop,F=0
TrailingStop,1=200.00000000
TrailingStop,2=100.00000000
TrailingStop,3=1000.00000000
lots=0.10000000
lots,F=0
lots,1=0.10000000
lots,2=0.00000000
lots,3=0.00000000
MM=1
Risk=0.00100000
Risk,F=0
Risk,1=0.50000000
Risk,2=0.00000000
Risk,3=0.00000000
multilot=1.00000000
multilot,F=0
multilot,1=1.00000000
multilot,2=0.00000000
multilot,3=0.00000000
closeby=0
sh2=8
sh2,F=0
sh2,1=2
sh2,2=1
sh2,3=10
sh3=4
sh3,F=0
sh3,1=2
sh3,2=1
sh3,3=10
sh4=8
sh4,F=0
sh4,1=2
sh4,2=1
sh4,3=10
sh5=8
sh5,F=0
sh5,1=2
sh5,2=1
sh5,3=10
per_rsi=4
per_rsi,F=0
per_rsi,1=2
per_rsi,2=1
per_rsi,3=7
sars1=0.04100000
sars1,F=0
sars1,1=0.00200000
sars1,2=0.00100000
sars1,3=0.05000000
sars2=0.00700000
sars2,F=0
sars2,1=0.00200000
sars2,2=0.00100000
sars2,3=0.05000000

 
Hello Mich, good job!
You can also post a version with a trailing stop for brokers to 4 decimal places?
Thank you.
 

double LotSize()
  {
  double DecreaseFactor=multilot;
  
  double lot=lots;
  int orders=HistoryTotal(); // history orders total
  int losses=0; // number of losses orders without a break
//---- select lot size
  lot=MathCeil(AccountFreeMargin() * Risk / 1000)/10;
//---- 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>0) lot=NormalizeDouble(lot-(-1)*lot*DecreaseFactor,1);
  }
//---- return lot size
  if(!MM) lot=lots;
  if(lot<0.1) lot=0.1;
  if(Micro==true) lot=lot/10;
  return(lot);
  }
 

Halou;)

This is lots size funktion with microlots posibility.Paste this where old one is.

And this:

extern bool MM = false;
extern bool Micro = false;     

add to input parameters.

Regards

 

Thank you for your willingness, Mich.


Unfortunately I am no expert mq4 language and I can not change the ea ...


You might post a file already compiled please?

 
#property copyright ""
#property link      ""
extern bool         MoneyManagement = FALSE;
extern double       TakeProfit = 700;
extern double       StopLoss = 2500;
extern int          ExpireMinutes = 5555;
extern double       Risk = 0.05;
extern double       LotsMin = 0.01;
extern double       LotsMax = 2;
extern bool         CloseBySignal = FALSE;
extern int          MagicNumber = 88;
extern int          ShiftLongChart = 3;
extern int          ShiftLongH1 = 3;
extern int          ShiftShortChart = 3;
extern int          ShiftShortH1 = 3;
extern int          RSILong = 3;
extern int          RSIShort = 3;
int    giPrevTime = 0;
int    giMagicNumber = 0;
int    giSlippage = 3;
int    giTakeProfit = 200;
int    giStopLoss = 200;
int    giExpireSeconds = 5555;
int    giRSILong = 3;
int    giRSIShort = 3;
bool   gbCloseBySignal = FALSE;
bool   gbMoneyManagement = FALSE;
double gdRisk = 0.01;
double gdLotsMin = 0.01;
double gdLotsMax = 0.01;
int    giShiftLongChart, giShiftLongH1, giShiftShortChart, giShiftShortH1;
int init(){
   
   giMagicNumber = checkPositive(MagicNumber);
   giTakeProfit = checkPositive(TakeProfit);
   giStopLoss = checkPositive(StopLoss); 
   gbCloseBySignal = CloseBySignal;
   giExpireSeconds = checkPositive(ExpireMinutes)*60; 
   giShiftLongChart = checkShift(ShiftLongChart);
   giShiftLongH1 = checkShift(ShiftLongH1);
   giShiftShortChart = checkShift(ShiftShortChart);
   giShiftShortH1 = checkShift(ShiftShortH1);
   giRSILong = checkPositive(RSILong);
   giRSIShort = checkPositive(RSIShort);
   gdLotsMin = LotsMin;
   gdLotsMax = LotsMax;
   gdRisk = Risk;
   gbMoneyManagement = MoneyManagement;
}
int checkPositive(int iValue){
   if (iValue < 0){
      iValue = 0;
   }
   return(iValue);
}
int checkShift(int iShift){
   if (iShift < 3){
      iShift = 3;
   }
   return(iShift);
}
int start(){
   
   if (!IsTradeAllowed()) {     
      return(0);
   }
   int liTradeSignal = tradeSignal();
   bool lbCloseLong,lbCloseShort;
   int liOT = OrdersTotal();   
   for (int i = 0; i < liOT; i++) {
      OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol() == Symbol() && OrderMagicNumber() == giMagicNumber) {
         lbCloseLong = FALSE;
         lbCloseShort = FALSE;   
         if(TimeCurrent()-OrderOpenTime() >= giExpireSeconds){ 
            lbCloseLong = TRUE;
            lbCloseShort = TRUE;            
         }
         if (gbCloseBySignal != FALSE){
            if (liTradeSignal < 0){
               lbCloseLong = TRUE;
            }
            if (liTradeSignal > 0){
               lbCloseShort = TRUE;
            }
         } 
         if(OrderType() == OP_BUY && lbCloseLong != FALSE){             
            OrderClose(OrderTicket(),OrderLots(), NormalizeDouble(Bid, Digits), giSlippage ,GreenYellow);
         }
         if(OrderType() == OP_SELL && lbCloseShort != FALSE){             
            OrderClose(OrderTicket(),OrderLots(), NormalizeDouble(Ask, Digits), giSlippage ,GreenYellow);
         }
         return(0);
      } 
   }   
   double ldLots = 0;  
   if (gbMoneyManagement != FALSE){
      ldLots = (AccountFreeMargin()*gdRisk)/(giStopLoss*MarketInfo(Symbol(), MODE_TICKVALUE));
   }
   lotSizeCheck(ldLots, gdLotsMin, gdLotsMax);
   
   int liTicket = -1;   
   RefreshRates();   
   if (liTradeSignal > 0) {
      liTicket = OrderSend(Symbol(), OP_BUY, ldLots, NormalizeDouble(Ask, Digits), giSlippage, 
         NormalizeDouble(Bid - giStopLoss * Point, Digits),
         NormalizeDouble(Bid + giTakeProfit * Point, Digits), WindowExpertName(), giMagicNumber, 0, Blue);      
   } if (liTradeSignal < 0) {
      liTicket = OrderSend(Symbol(), OP_SELL, ldLots, NormalizeDouble(Bid, Digits), giSlippage, 
         NormalizeDouble(Ask + giStopLoss * Point, Digits), 
         NormalizeDouble(Ask - giTakeProfit * Point, Digits), WindowExpertName(), giMagicNumber, 0, Red);    
   }
   return(0);
}
void lotSizeCheck(double& rdLots, double dMinLots, double dMaxLots){
    
   if (rdLots < MarketInfo(Symbol(), MODE_MINLOT)){
      rdLots = MarketInfo(Symbol(), MODE_MINLOT);
   } 
   if (rdLots < dMinLots){
      rdLots = dMinLots;
   }
   if (rdLots > MarketInfo(Symbol(), MODE_MAXLOT)){
      rdLots = MarketInfo(Symbol(), MODE_MAXLOT);
   } 
   if (rdLots > dMaxLots){
      rdLots = dMaxLots;
   }
}
 
int fractalSignal(int iPeriod, int iShift){
     
   double ldFractalUp = iFractals(NULL, iPeriod, MODE_UPPER, iShift);
   double ldFractalDn = iFractals(NULL, iPeriod, MODE_LOWER, iShift);
    
   if (ldFractalUp==0 && ldFractalDn != 0){ return(1); }
   if (ldFractalDn==0 && ldFractalUp != 0){ return(-1); }
     
   return (0);
}    
int tradeSignal()   {
   double ldRSI=iRSI(NULL, PERIOD_D1, 3, PRICE_OPEN, 0);
   if (fractalSignal(0, giShiftLongChart) > 0 && fractalSignal(PERIOD_H1, giShiftLongH1) > 0  && ldRSI < 50-giRSILong){ return(1); }
   if (fractalSignal(0, giShiftShortChart) < 0 && fractalSignal(PERIOD_H1, giShiftShortH1) < 0  && ldRSI > 50+giRSIShort){ return(-1); }
   return(0);
}
Did a bit of cleaning up of the code. A bit more than I had in mind....
 
Thanks a Lot !