What's the Error in my EA? - page 2

 
And have you retested with that change?
 
WHRoeder:
And have you retested with that change?

yep! same results :-(
 

just to avoid any doubt here the entire code of the EA without other filters, only applying the FX5_MACD_Divergence_V1.0 custom indicator

for testing purpose about this problem

 

#property copyright "Lorenz Grisenti"
#property link      ""
#include <stdlib.mqh>
#include <IncludeExample.mqh>

//variabili esterne
extern bool DynamicLotSize = true;
extern double EquityPercent = 1;
extern double FixedLotSize = 0.01;
extern double StopLoss = 10;
extern double TakeProfit = 30;
extern int Slippage = 0;
extern int MagicNumber = 101;
extern bool CheckOncePerBar = true;

// la prossima variabile determina se la strategia parte dal prezzo di 
// chiusura (true) o dal High-low (false) della barra giornaliera precedente
extern bool ApplyOnCloseOrExtreme = true;
// differenza di pip dall'ultima chiusura o dall'ultimo High-low da aspettare
// per far scattare l'ordine

//Fisher Properties
extern int     RangePeriods=30;
extern double  PriceSmoothing=0.3;    // =0.67 bei Fisher_m10 
extern double  IndexSmoothing=0.3;    // =0.50 bei Fisher_m10

//Damiani_volatmeter Properties
extern int       Viscosity=7;
extern int       Sedimentation=50;
extern double    Threshold_level=1.1;
extern bool      lag_supressor=true;

//FX5_MACD-Div
extern string separator1 = "*** MACD Settings ***";
extern int    fastEMA = 12;
extern int    slowEMA = 26;
extern int    signalSMA = 9;
extern string separator2 = "*** Indicator Settings ***";
extern bool   drawIndicatorTrendLines = true;
extern bool   drawPriceTrendLines = true;
extern bool   displayAlert = false;

//Variabili Globali
int BuyStopTicket;
int SellStopTicket;
int CloseTicket;
double UsePoint;
int UseSlippage;
int ErrorCode;
datetime CurrentTimeStamp;
double StopLossRate;
double TakeProfitRate;
bool Deleted;
         
//Funzione per l'utilizzo dei parametri corretti relativi al nr. di posizioni decimali
//a seconda delle impostazioni del Broker. La funzione richiamata si trova nella
//libreria richiamata con INCLUDE
int init()
   {
    UsePoint = PipPoint(Symbol());
    UseSlippage = GetSlippage(Symbol(),Slippage);
 
                }

//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
   
                
 {
      //Da inserire eventuali condizioni di indicatori
      
           //Calcolo della dimensione del Lot
      double LotSize = CalcLotSize(DynamicLotSize,EquityPercent,StopLoss,FixedLotSize);
      
      double PendingPrice;
      //Verifica della dimensione minima o massima del Lot consentita dal Broker con conseguente arrotondamento
      //per adeguarne la dimensione e permettere il trade.
     
      LotSize = VerifyLotSize(LotSize);
      
      
      //PROCEDURA DI TRADING
     
     
     
         //condizione della barra precedente
          // Opzione di Trading quando è partita la nuova candela
                // 
                if(CheckOncePerBar == true)
                        {
                                int BarShift = 1;
                                if(CurrentTimeStamp != Time[0]) 
                                        {
                                                CurrentTimeStamp = Time[0];
                                                bool NewBar = true;
                                        }
                                else NewBar = false;
                        }
                else 
                        {
                                NewBar = true;
                                BarShift = 0;
                        }
         
         
        if (NewBar == true) 
               //inserire chiusura ordini non triggerati e/o ordini ancora in corso

     
            
   
        
        
        
 
                  
          {         
             
                 /* double BuySignal = iCustom(NULL,0,"FX5_MACD_Divergence_V1.1",separator1,fastEMA,slowEMA,signalSMA,separator2,drawIndicatorTrendLines,drawPriceTrendLines,displayAlert,0,1);
                  double SellSignal = iCustom(NULL,0,"FX5_MACD_Divergence_V1.1",separator1,fastEMA,slowEMA,signalSMA,separator2,drawIndicatorTrendLines,drawPriceTrendLines,displayAlert,1,1);
                  
                  Print("Buy Signal: "+BuySignal+", Sell Signal: "+SellSignal+"Time: "+TimeToStr(Time[1]));
                  */
                 
                  
                  if  (iCustom(NULL,0,"FX5_MACD_Divergence_V1.0","*** MACD Settings ***",12,26,9,"*** Indicator Settings ***",true,true,true,0,1) != EMPTY_VALUE)
                    
                        
                        {
                                          CloseAllSellOrders(Symbol(), MagicNumber, UseSlippage);
                                          //CloseAllSellStopOrders(Symbol(),MagicNumber);
                              
                                          StopLossRate = Bid - StopLoss * UsePoint;
                        
                                          double argStopLoss = (Bid - StopLossRate)/UsePoint;
                                                                      
                                          LotSize = CalcLotSize(DynamicLotSize,EquityPercent,argStopLoss,FixedLotSize);
                          
                                          LotSize = VerifyLotSize(LotSize);
                        
                                          int BuyTicket = OpenBuyOrder(Symbol(),LotSize,UseSlippage,MagicNumber,"Buy Order");
                        
                                          TakeProfitRate = Bid + TakeProfit * UsePoint;   
                                                                 
                                          AddStopProfit(BuyTicket,StopLossRate,TakeProfitRate);
   
                      
                        }
            
                      if (  /*
                           (iCustom(NULL,0,"Damiani_volatmeter",Viscosity,Sedimentation,Threshold_level,lag_supressor,2,1) >  iCustom(NULL,0,"Damiani_volatmeter",Viscosity,Sedimentation,Threshold_level,lag_supressor,0,1))
                           && */
                            (iCustom(NULL,0,"FX5_MACD_Divergence_V1.0","*** MACD Settings ***",12,26,9,"*** Indicator Settings ***",true,true,true,1,1) != EMPTY_VALUE)
                    
                        )
                          {
                                          CloseAllBuyOrders(Symbol(), MagicNumber, UseSlippage);
                                          //CloseAllSellStopOrders(Symbol(),MagicNumber);
                              
                                          StopLossRate = Ask + StopLoss * UsePoint;
                        
                                          argStopLoss = (Ask + StopLossRate)/UsePoint;
                                                                      
                                          LotSize = CalcLotSize(DynamicLotSize,EquityPercent,argStopLoss,FixedLotSize);
                          
                                          LotSize = VerifyLotSize(LotSize);
                        
                                          int SellTicket = OpenSellOrder(Symbol(),LotSize,UseSlippage,MagicNumber,"Sell Order");
                        
                                          TakeProfitRate = Ask - TakeProfit * UsePoint;   
                                                                 
                                          AddStopProfit(BuyTicket,StopLossRate,TakeProfitRate); 
        
                          }
                  
                 
                  
                  
               
         } 
  }        
      
     
//----
   
//----
   return(0);
  
//+------------------------------------------------------------------+

 

 
glorenz75:

just to avoid any doubt here the entire code of the EA without other filters, only applying the FX5_MACD_Divergence_V1.0 custom indicator

for testing purpose about this problem

 

 

 

 


#property copyright "Lorenz Grisenti"
#property link      ""

int init(){

return(0);
}
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
   
                
 {
if(NewBar()){
    int cnt;
    for(cnt=0;cnt<12;cnt++)
    {
     double fx5_0 = iCustom(NULL,0,"FX5_MACD_Divergence_V1.0","*** MACD Settings ***",12,26,9,"*** Indicator Settings ***",true,true,true,0,cnt);
     if(fx5_0 != EMPTY_VALUE)
      Print (cnt,"  fx5_0 =  ",fx5_0);
     double fx5_1 = iCustom(NULL,0,"FX5_MACD_Divergence_V1.0","*** MACD Settings ***",12,26,9,"*** Indicator Settings ***",true,true,true,1,cnt);                 
     if(fx5_1 != EMPTY_VALUE)
      Print (cnt,"  fx5_1 =  ",fx5_1);
     }                         
 }
  }        
      
     
//----
   
//----
   return(0);
//+------------------------------------------------------------------+
bool NewBar()
{
   static datetime dt = 0;
   int newtime = Time[0];//iTime(Symbol(),PERIOD_M1,0);  
   if (newtime != dt)
     {
      if(dt==0)
         {
         dt = newtime;
         return(false);
         }
      dt = newtime;
      return(true);
     }
   return(false);
}
//+------------------------------------------------------------------+    
//+------------------------------------------------------------------+

Place this as ea and test it with strategytester

 Do you see the problem ?? 

 
deVries:

Place this as ea and test it with strategytester

 Do you see the problem ?? 


Goshhhhh!!!! thank you very much for taking the time to help me! resolved!

thank you very much! :-)