9 weeks x30.generously shared.needs upgrade for live trading.I have one another live profitable,need help a bit.

 


#define OrderStr "MasterMind3CE By L.Bigger AKA Silence"
#property copyright "Copyright © 2008, CreativeSilence, Inc."
#property link      "http://www.creative-silence.com"



 
extern int    Shift1          = 0;
extern int    Shift2          = 1;
extern int    Shift3          = 2;


bool buysig,sellsig;

extern double  Lots = 1;
extern int  StopLoss = 100;
extern int   TakeProfit = 400;
extern bool  TradeAtCloseBar = true;
extern int   TrailingStop = 5;
extern int   TrailingStep = 1;      //Trailing step
extern int     BreakEven = 30;
extern int    MagicNumber=0;
//For alerts:
extern int     Repeat=3;
extern int     Periods=5;
extern bool    UseAlert=false;
extern bool    SendEmail=true;
extern string
   TradeLog="MasterMind3";
 

extern int  Slippage = 3;
 
int           mm = -1;
double         Risk = 5;
int           Crepeat=0;
int            AlertTime=0;
double         AheadTradeSec = 200;
double         AheadExitSec = 0;
int        TradeBar = 0;
double         MaxTradeTime =100;
 
extern string  
         Indicator_Setting = "---------- Indicator Setting";
extern   bool     Crash = false;
extern   int      TimeFrame = 0;
extern   int      Length = 5;
extern   int      Method = 3;
extern   int      Smoothing = 1;
extern   int      Filter = 5;
 
extern   bool     RealTime = true;
extern   bool     Steady  = false;
extern   bool     Color = true;
extern   bool     Alerts = true;
extern   bool     EmailON = false;
extern   bool     SignalPrice = true;
extern   color    SignalPriceBUY = Yellow;
extern   color    SignalPriceSELL = Aqua;
extern   int      CountBars = 1485;
 double maxEquity;
double minEquity;
double CECount;
double CEProc;
double CEBuy;
double CESell;

extern int    BasketProfit=100000;
extern int    BasketLoss=500000;
int
     NumberOfTries  = 5, //Number of tries to set, close orders;
     RetryTime   = 1; 
 
 
 
double 
   Ilo     = 0;
 
int DotLoc=7;
static int TradeLast=0;

 
string sound="alert.wav";
 
double sig_buy=0, sig_sell=0, sig_high=0, sig_low=0,sig_low2=0;
 
int Spread=0;
string filename="";
 
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//---- 
 

Crepeat=Repeat;    
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
if (TradeAtCloseBar) TradeBar=1;
else TradeBar=0;
 
filename=Symbol() + TradeLog + "-" + Month() + "-" + Day() + ".log";
 

Spread=MarketInfo(Symbol(),MODE_SPREAD);


/*--------------------------------*/
 

double CurrentBasket=0;
//Basket profit or loss
CurrentBasket=AccountEquity()-AccountBalance();
   
if(CurrentBasket>maxEquity) maxEquity=CurrentBasket;
if(CurrentBasket<minEquity) minEquity=CurrentBasket;
   
// actual basket closure
if( CurrentBasket>=BasketProfit || CurrentBasket<=(BasketLoss*(-1)) )
{
CloseEverything();
CECount++;
}


//--*-----------------------------------------------------------

int BuyCCI=0;
int SellCCI=0;

if (iCCI(NULL, 0, 8, PRICE_TYPICAL, 0) < iCCI(NULL, 0, 9, PRICE_TYPICAL, 0))

{SellCCI=1;} //disablebuy

if (iCCI(NULL, 0,8, PRICE_TYPICAL, 0) > iCCI(NULL, 0, 9, PRICE_TYPICAL, 0))

{BuyCCI=1;}

//-----------------------------------------------

int SellOsma=0;
int BuyOsma=0;

if (iOsMA(NULL, 0, 12, 26, 9, PRICE_OPEN, 1) < iOsMA(NULL, 0, 12, 26, 9, PRICE_OPEN, 0))
{SellOsma=1;}

if (iOsMA(NULL, 0, 12, 26, 9, PRICE_OPEN, 1) > iOsMA(NULL, 0, 12, 26, 9, PRICE_OPEN, 0))
{BuyOsma=1;}


/*-----------------------------------------------------------------------------------------------------------*/
int BuyOp=0,SellOp=0;

if (High[Shift1]>High[Shift2]&&High[Shift2]>High[Shift3]&&Open[Shift1]>Open[Shift2]&&Open[Shift2]>Open[Shift3]){ BuyOp=1;}
if (High[Shift1]<High[Shift2]&&High[Shift2]<High[Shift3]&&Open[Shift1]<Open[Shift2]&&Open[Shift2]<Open[Shift3]) {SellOp=1;}

//--------------------------------------------------------



//----------------------------------------------------------

 
int   i=0;
 
double   BuyValue=0, SellValue=0;
BuyValue=0; SellValue=0;
 

if (CntOrd(OP_BUY,MagicNumber)>0) TradeLast=1;
if (CntOrd(OP_SELL,MagicNumber)>0) TradeLast=-1;


int total=OrdersHistoryTotal()-1;
for(int t1=total; t1 >=1;   t1--)
{
 
 if(OrderSelect(total,SELECT_BY_POS,MODE_HISTORY)==true)
  
 double kar1 =OrderProfit();
  
 } 
  
int total2=OrdersHistoryTotal()-2;
for(int t2=total2; t2 >=1;   t2--)
{
 
 if(OrderSelect(total2,SELECT_BY_POS,MODE_HISTORY)==true)
  
 double kar2 =OrderProfit();
  
 } 
  
 
 int total3=OrdersHistoryTotal()-3;
for(int t3=total3; t3 >=1;   t3--)
{
 
 if(OrderSelect(total3,SELECT_BY_POS,MODE_HISTORY)==true)
  
 double kar3 =OrderProfit();
  
 } 
  
  
  
  int total4=OrdersHistoryTotal()-4;
for(int t4=total4; t4 >=1;   t4--)
{
 
 if(OrderSelect(total4,SELECT_BY_POS,MODE_HISTORY)==true)
  
 double kar4 =OrderProfit();
  
 } 
 
 
 
   int total5=OrdersHistoryTotal()-5;
for(int t5=total5; t5 >=1;   t5--)
{
 
 if(OrderSelect(total5,SELECT_BY_POS,MODE_HISTORY)==true)
  
 double kar5 =OrderProfit();
  
 } 
 
 
if(AccountBalance()<100){Risk = 5;}
if(AccountBalance()>120){Risk = 7;}
  if(AccountBalance()>180){Risk = 8;}
   if(AccountBalance()>260){Risk = 9;}
    if(AccountBalance()>360){Risk = 11;}
     if(AccountBalance()>500){Risk = 13;}
      if(AccountBalance()>700){Risk = 15;}
       
 
 if(AccountBalance()>100){Risk = 4;}
 
 
Ilo=Lots;
if (mm<0) 
  {
 Ilo=MathCeil(AccountFreeMargin()*Risk/715)/10-0.1;

 if (Ilo<0.1) Ilo=0.1;  
  }
if (mm>0) 
  {
 Ilo=MathCeil(AccountEquity()*Risk/100)/10-1;
 if (Ilo>1) Ilo=MathCeil(Ilo);

    if (Ilo<1) Ilo=1;  

  }
if (Ilo>100) {Ilo=100;}
if (Ilo==0.1 && AccountBalance()>100 ) {Ilo=0.2;}
 
double tak=0;
tak=CurrentBasket/Ilo;
int Spread = (Ask - Bid) / Point + 0.1;




if(tak>=50){TrailingStop = 30;}
 BreakEven=70;

 
                          
sig_buy=iWPR(NULL,0,96,0);
sig_sell=iWPR(NULL,0,100,0);
sig_high=iWPR(NULL,0,108,0);
sig_low=iWPR(NULL,0,112,0);
  
 StopLoss=100;
TakeProfit=1000;
TrailingStop=40;
TrailingStep=10;
if(tak>=40){TrailingStop = 30;}
if(kar1>0 && kar2>0 || kar1>0 && kar3>0   ){

 
                          
sig_buy=iWPR(NULL,0,26,0);
sig_sell=iWPR(NULL,0,27,0);
sig_high=iWPR(NULL,0,29,0);
sig_low=iWPR(NULL,0,30,0);
  
 StopLoss=110;
TakeProfit=1000;
TrailingStop=40;
TrailingStep=10;
if(tak>=40){TrailingStop = 30;}
}


  
if(kar1<=0 && kar2<=0 || kar1<=0 && kar3<=0   )
 {StopLoss=70;
  TakeProfit=1000;
 TrailingStop=40;
 TrailingStep=10;
 BreakEven=0;

if(tak>=30){TrailingStop = 30;}

  sig_buy=iWPR(NULL,0,216,0);
sig_sell=iWPR(NULL,0,223,0);
sig_high=iWPR(NULL,0,237,0);
sig_low=iWPR(NULL,0,244,0); 
 
 
 
 
 
 } 
 
 
 if ((sig_buy<-98 && sig_sell<-98 && sig_high<-98 && sig_low<-98 ) && BuyOsma==1 || BuyCCI==1 || SellOp==1   ) {   
 BuyValue=1; 
}
 

if ((sig_buy>-2 && sig_sell>-2 && sig_high>-2 && sig_low>-2)&&  SellOsma==1 || SellCCI==1  || BuyOp==1    ) {     
 SellValue=1;
}  

if(kar1>0 && kar2>0 && kar3>0  )
 {
 StopLoss=120;
 TakeProfit=1000;
TrailingStop=40;
TrailingStep=10;



if(tak>=40){TrailingStop = 30;}

 
 
 sig_buy=iWPR(NULL,0,6,0);
sig_sell=iWPR(NULL,0,7,0);
sig_high=iWPR(NULL,0,9,0);
sig_low=iWPR(NULL,0,10,0); 
if ((sig_buy<-99 && sig_sell<-99 && sig_high<-99 && sig_low<-99 ) && BuyOsma==1 || BuyCCI==1 || SellOp==1   ) {   
 BuyValue=1; 
}
 

if ((sig_buy>-1 && sig_sell>-1 && sig_high>-1 && sig_low>-1)&&  SellOsma==1 || SellCCI==1  || BuyOp==1    ) {     
 SellValue=1;
}
 
 }
 //Comment("sig_buy=",sig_buy," sig_sell=",sig_sell); 
 
 

 
 

 
int  cnt=0,OpenPos=0,OpenSell=0,OpenBuy=0,CloseSell=0,CloseBuy=0;
double mode=0,Stop=0,NewBarTime=0;
 
//Here we found if new bar has just opened
static int prevtime=0;  
int NewBar=0,FirstRun=1;
 
if (FirstRun==1) {
FirstRun=0;
prevtime=Time[0];
}
if ((prevtime == Time[0]) &&  (CurTime()-prevtime)>MaxTradeTime) {
NewBar=0;
}
else {
prevtime = Time[0];
NewBar=1;
}
 

int   AllowTrade=0,AllowExit=0;
//Trade before bar current bar closed
if (CurTime()>= Time[0]+Period()*60-AheadTradeSec) AllowTrade=1; else AllowTrade=0;
if (CurTime()>= Time[0]+Period()*60-AheadExitSec) AllowExit=1; else AllowExit=0;
if (AheadTradeSec==0) AllowTrade=1;
if (AheadExitSec==0) AllowExit=1;




OpenPos=0;
for(cnt=0; cnt<OrdersTotal(); cnt++) {
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if ((OrderType()==OP_SELL || OrderType()==OP_BUY) && OrderSymbol()==Symbol() && ((OrderMagicNumber () == MagicNumber) || MagicNumber==0)) OpenPos=OpenPos+1;
}
 
if (OpenPos>=1) {
  OpenSell=0; OpenBuy=0;
}
 
 
 
OpenBuy=0; OpenSell=0;
CloseBuy=0; CloseSell=0;
 
//Conditions to open the position
//
if (SellValue>0  && Spread<25) {
 OpenSell=1;


}
 
if  (BuyValue>0  && Spread<25) {
 OpenBuy=1;
  

}
 
//Print("OpenSell=",OpenSell," OpenBuy=",OpenBuy);
 
 
 


 


//Conditions to close the positions
if (SellValue>0 ) {
 CloseBuy=1;
}
 

if (BuyValue>0 ) {
 CloseSell=1;
}
 
subPrintDetails();

for(cnt=0; cnt<OrdersTotal(); cnt++) {
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
 
 if (OrderType()==OP_BUY && OrderSymbol()==Symbol() && ((OrderMagicNumber () == MagicNumber) || MagicNumber==0)) {
  if (CloseBuy==1 && AllowExit==1) {
    if (NewBar==1 && TradeBar>0)
    {
       SetText(Time[0],High[0]+1*DotLoc*Point,("CloseBuy"+DoubleToStr(Time[0],0)),CharToStr(251),Magenta);
       PlaySound("alert.wav");
       OrdClose(OrderTicket(),OrderLots(),Bid,Slippage,Red);  
     Alerts(0, 0, CloseBuy, CloseSell,Bid,0,0,OrderTicket());
     return(0); 
    }
    if (TradeBar==0) 
    {  
       SetText(Time[0],High[0]+1*DotLoc*Point,("CloseBuy"+DoubleToStr(Time[0],0)),CharToStr(251),Magenta);
       PlaySound("alert.wav");
       OrdClose(OrderTicket(),OrderLots(),Bid,Slippage,Red);
     Alerts(0, 0, CloseBuy, CloseSell,Bid,0,0,OrderTicket());
     return(0); 
    }
   
  } 
 }
 
 if (OrderType()==OP_SELL && OrderSymbol()==Symbol() && ((OrderMagicNumber () == MagicNumber) || MagicNumber==0)) {
  if (CloseSell==1 && AllowExit==1) {
   if (NewBar==1 && TradeBar>0)
   {
       SetText(Time[0],High[0]-0.3*DotLoc*Point,("CloseSell"+DoubleToStr(Time[0],0)),CharToStr(251),Magenta);
       PlaySound("alert.wav");
       OrdClose(OrderTicket(),OrderLots(),Ask,Slippage,Red);
     Alerts(0, 0, CloseBuy, CloseSell,Ask,0,0,OrderTicket());
     return(0); 
   }
   if (TradeBar==0)
   {
               SetText(Time[0],High[0]-0.3*DotLoc*Point,("CloseSell"+DoubleToStr(Time[0],0)),CharToStr(251),Magenta);       
       PlaySound("alert.wav");
       OrdClose(OrderTicket(),OrderLots(),Ask,Slippage,Red);
     Alerts(0, 0, CloseBuy, CloseSell,Ask,0,0,OrderTicket());
     return(0); 
   }
 

  }
 }
 
}

double MyStopLoss=0, MyTakeProfit=0;
int ticket=0;
 
 

 
//Should we open a position?
if (OpenPos<=0) {
 if (OpenSell==1 && AllowTrade==1) {
  if (NewBar==1 && TradeBar>0) 
  {
      SetText(Time[0],High[0]+1*DotLoc*Point,("Sell"+DoubleToStr(Time[0],0)),CharToStr(234),Red);
      if (TakeProfit==0) MyTakeProfit=0; else MyTakeProfit=Bid-TakeProfit*Point;
   if (StopLoss==0) MyStopLoss=0; else MyStopLoss=Bid+StopLoss*Point;  
      PlaySound("alert.wav");
      ticket=OrdSend(Symbol(),OP_SELL,Ilo,Bid,Slippage,MyStopLoss,MyTakeProfit,OrderStr,MagicNumber,0,Red);
  Alerts(OpenBuy, OpenSell, 0, 0,Bid,MyStopLoss,MyTakeProfit,ticket);
  OpenSell=0;
  return(0);
  }
  if (TradeBar==0)
  {
  SetText(Time[0],High[0]+1*DotLoc*Point,("Sell"+DoubleToStr(Time[0],0)),CharToStr(234),Red);  
      if (TakeProfit==0) MyTakeProfit=0; else MyTakeProfit=Bid-TakeProfit*Point;
   if (StopLoss==0) MyStopLoss=0; else MyStopLoss=Bid+StopLoss*Point;  
      PlaySound("alert.wav");
      ticket=OrdSend(Symbol(),OP_SELL,Ilo,Bid,Slippage,MyStopLoss,MyTakeProfit,OrderStr,MagicNumber,0,Red);  
  Alerts(OpenBuy, OpenSell, 0, 0,Bid,MyStopLoss,MyTakeProfit,ticket);
  OpenSell=0;
  return(0);  
  }
 } 
 if (OpenBuy==1 && AllowTrade==1) {
  if (NewBar==1 && TradeBar>0)
  {
      SetText(Time[0],Low[0]-0.3*DotLoc*Point,("Buy"+DoubleToStr(Time[0],0)),CharToStr(233),Lime);
      if (TakeProfit==0) MyTakeProfit=0; else MyTakeProfit=Ask+TakeProfit*Point;
      if (StopLoss==0) MyStopLoss=0; else MyStopLoss=Ask-StopLoss*Point;        
      PlaySound("alert.wav");
      ticket=OrdSend(Symbol(),OP_BUY,Ilo,Ask,Slippage,MyStopLoss,MyTakeProfit,OrderStr,MagicNumber,0,Lime);
  Alerts(OpenBuy, OpenSell, 0, 0,Ask,MyStopLoss,MyTakeProfit,ticket);
  OpenBuy=0;
  return(0);
  }
  if (TradeBar==0)
  {
      SetText(Time[0],Low[0]-0.3*DotLoc*Point,("Buy"+DoubleToStr(Time[0],0)),CharToStr(233),Lime);
      if (TakeProfit==0) MyTakeProfit=0; else MyTakeProfit=Ask+TakeProfit*Point;
      if (StopLoss==0) MyStopLoss=0; else MyStopLoss=Ask-StopLoss*Point;        
      PlaySound("alert.wav");
      ticket=OrdSend(Symbol(),OP_BUY,Ilo,Ask,Slippage,MyStopLoss,MyTakeProfit,OrderStr,MagicNumber,0,Lime);
  Alerts(OpenBuy, OpenSell, 0, 0,Ask,MyStopLoss,MyTakeProfit,ticket);
  OpenBuy=0;
  return(0);
  }
  
 }
 
}
 
 
 
for (i=0; i<OrdersTotal(); i++) {
   if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
      if (OrderSymbol()==Symbol() && ((OrderMagicNumber () == MagicNumber) || MagicNumber==0)) {
         TrailingPositions();
      }
   }
}
 

Alerts(0, 0, 0, 0, 0, 0, 0, 0);
 
 


 
 
bored.for other parts copy and paste from mastermind3.
 

I don't understand what you are asking ? Why did you post your source in the forum ? Have you tried submitting a 'job' to get this EA ready to live trade?

https://www.mql5.com/en/job

Equity chart looks impressive though...nice work.

Chris.

https://www.mql5.com/en/users/Chris_V

 

thank u.

I just want to see same results with some one.and want to find better settings.I dont have much time for optimizing.

 

and next 5 months .opened from 5k to 40k.same settings

 

Strategy Tester Report

14
AlpariUK-Demo - Micro+Classic (Build 432)

SembolEURUSD (Euro vs US Dollar)
Zaman aralığı5 Dakika (D5) 2011.03.01 00:00 - 2012.07.05 23:55 (2011.03.01 - 2012.07.06)
ModelEvery tick (the most precise method based on all available least timeframes)
ParametrelerShift1=0; Shift2=1; Shift3=2; Lots=1; StopLoss=100; TakeProfit=400; TradeAtCloseBar=true; TrailingStop=5; TrailingStep=1; BreakEven=30; MagicNumber=0; Repeat=3; Periods=5; UseAlert=false; SendEmail=true; TradeLog="MasterMind3"; Slippage=3; Indicator_Setting="---------- Indicator Setting"; Crash=false; TimeFrame=0; Length=5; Method=3; Smoothing=1; Filter=5; RealTime=true; Steady=false; Color=true; Alerts=true; EmailON=false; SignalPrice=true; SignalPriceBUY=Yellow; SignalPriceSELL=Aqua; CountBars=1485; BasketProfit=100000; BasketLoss=500000;
Barlar denemede96255Tikler modellenmiş25051180Modelling quality90.00%
Mismatched charts errors2
Başlangıç depozitosu5000.00
Toplam net kar1162119.17Toplam kar4092209.79Toplam zarar-2930090.62
Profit factor1.40Expected payoff499.62
Absolute drawdown867.70En fazla düşüş (%)120800.00 (11.96%)Relative drawdown63.92% (14493.02)
Toplam işlem2326Short positions (won %)1133 (80.41%)Long positions (won %)1193 (76.36%)
Profit trades (% of total)1822 (78.33%)Zararlı işlemler(% olarak)504 (21.67%)
En büyükprofit trade21600.00loss trade-12090.00
Ortalamaprofit trade2246.00loss trade-5813.67
Maximumconsecutive wins (profit in money)39 (171010.00)consecutive losses (loss in money)5 (-46000.00)
Maximalconsecutive profit (count of wins)171010.00 (39)consecutive loss (count of losses)-46000.00 (5)
Ortalamaconsecutive wins5consecutive losses1