Simple experts - page 5

 
borgesr:
Dear Mladen,

You tested the EA AsctrendBuySellExpert_v1.71 broker 5 digit nmc.mq4?

Url https://www.mql5.com/en/forum/173249/page87

By posts EA is very old and at the beginning was very efficient.

I saw that you did some sort of adjustment in this latest version.

Thank you,

Rogério

Yes, I made it new metatrader 4 compatible

 

Do you recommend using the indicator PriceChannel_Stop_v1.3 to trailing stop?

Checked version 6 but shows nothing on the graph even though Signal=1.

I am looking for a trailing stop functioning properly.

I saw many in ATR, indicators etc.

Regards,

Rogério

 

Dear Mladen,

I tested EA ma_cross_advanced.mq4 in ERUUSD H4 and had good results.
But he only has good results in EURUSD tried in other timeframes but zeroing the account using the same parameters

It is possible to be a problem in the number of digits of the broker?


Regards,

Rogério

Files:
 
borgesr:

Dear Mladen,

I tested EA ma_cross_advanced.mq4 in ERUUSD H4 and had good results.
But he only has good results in EURUSD tried in other timeframes but zeroing the account using the same parameters

It is possible to be a problem in the number of digits of the broker?


Regards,

Rogério

Rogério


No, that can not happen because of the broker digits

If it was so, then it would not work on any time frame. Usually EAs perform well on some symbols and/or time frames and that is normal "behavior " for experts

 
mladen:

Rogério


No, that can not happen because of the broker digits

If it was so, then it would not work on any time frame. Usually EAs perform well on some symbols and/or time frames and that is normal "behavior " for experts

Thanks for the quick response.


I did the test back in 2 broker.
A 4 digits and one with 5 digits.
The result with 4 digits was much better.

The 5 digit reset the account using the same parameters.

See attached file.


Regards,

Rogério

Files:
 
borgesr:

Thanks for the quick response.


I did the test back in 2 broker.
A 4 digits and one with 5 digits.
The result with 4 digits was much better.

The 5 digit reset the account using the same parameters.

See attached file.


Regards,

Rogério

I tried to adjust the point with the code below.
But unfortunately the result remains the same.

In broker 5 digits have a loss of almost 100% and the 4-digit gain of 86% in 3 months using the same parameters in EURUSD H4.


I could not understand why this difference between the two brokers.


int init()
  {
//----
   digits=MarketInfo(Symbol(),MODE_DIGITS);    
  
   if (digits==2 || digits==4) PointRatio = 1;
   if (digits==3 || digits==5) PointRatio = 10;
   if (digits==6)             PointRatio = 100;
   myPoint  = MarketInfo(Symbol(),MODE_POINT) * PointRatio; 
       
 
  int JPY_pair=StringFind(Symbol(),"JPY",0);
  if(JPY_pair==-1){switch(digits)
                  { case 4:{myPoint=Point;return(myPoint);}
                    case 5:{myPoint=10*Point;return(myPoint);}
                  }
                 }
  if(JPY_pair==3){myPoint=0.01;return(myPoint);}
 
//----
   return(0);
  }

 

Dear Mladen,

I would like to test their two indicators in an EA.

1 - Parabolic SAR of KAMA.mq4

2 - Macd - std normalized.mq4 1_2 (Filter)


I'm trying the code below is correct?

      int doWhat = _doNothing;
      double sarUp = iCustom(NULL,0,"Parabolic SAR of KAMA 1_5","",AccStep,AccLimit,AmaPeriod,AmaPrice,FastEnd,SlowEnd,SmoothPower,JurikFDAdaptive,0,BarToUse);
      double sarDn = iCustom(NULL,0,"Parabolic SAR of KAMA 1_5","",AccStep,AccLimit,AmaPeriod,AmaPrice,FastEnd,SlowEnd,SmoothPower,JurikFDAdaptive,1,BarToUse+1);
     
      double macdUp= iCustom(NULL,0,"Macd - std normalized 1_2 histo","",FastMAPeriod,SlowMAPeriod,SignalPeriod,StdPeriod,Price,Filter,FilterPeriod,ColorChangeOn,0,BarToUse);
      double macdDn= iCustom(NULL,0,"Macd - std normalized 1_2 histo","",FastMAPeriod,SlowMAPeriod,SignalPeriod,StdPeriod,Price,Filter,FilterPeriod,ColorChangeOn,1,BarToUse+1);
     
      if (sarUp!=sarDn & macdUp!=macdDn)
         if (sarUp==1 & macdUp==1) //buy
               doWhat = _doBuy;
         else  doWhat = _doSell;
         if (doWhat==_doNothing && !DisplayInfo) return(0);

        


Follow EA attached.

Thank you

Rogério

 
borgesr:

Dear Mladen,

I would like to test their two indicators in an EA.

1 - Parabolic SAR of KAMA.mq4

2 - Macd - std normalized.mq4 1_2 (Filter)


I'm trying the code below is correct?

      int doWhat = _doNothing;
      double sarUp = iCustom(NULL,0,"Parabolic SAR of KAMA 1_5","",AccStep,AccLimit,AmaPeriod,AmaPrice,FastEnd,SlowEnd,SmoothPower,JurikFDAdaptive,0,BarToUse);
      double sarDn = iCustom(NULL,0,"Parabolic SAR of KAMA 1_5","",AccStep,AccLimit,AmaPeriod,AmaPrice,FastEnd,SlowEnd,SmoothPower,JurikFDAdaptive,1,BarToUse+1);
     
      double macdUp= iCustom(NULL,0,"Macd - std normalized 1_2 histo","",FastMAPeriod,SlowMAPeriod,SignalPeriod,StdPeriod,Price,Filter,FilterPeriod,ColorChangeOn,0,BarToUse);
      double macdDn= iCustom(NULL,0,"Macd - std normalized 1_2 histo","",FastMAPeriod,SlowMAPeriod,SignalPeriod,StdPeriod,Price,Filter,FilterPeriod,ColorChangeOn,1,BarToUse+1);
     
      if (sarUp!=sarDn & macdUp!=macdDn)
         if (sarUp==1 & macdUp==1) //buy
               doWhat = _doBuy;
         else  doWhat = _doSell;
         if (doWhat==_doNothing && !DisplayInfo) return(0);

        


Follow EA attached.

Thank you


Rogério

Rogério

Please read this post : https://www.forex-tsd.com/forum/announcements-forex-press/1809030-temporary-workaround-for-source-mq4-files-upload

 
borgesr:

Dear Mladen,

I would like to test their two indicators in an EA.

1 - Parabolic SAR of KAMA.mq4

2 - Macd - std normalized.mq4 1_2 (Filter)


I'm trying the code below is correct?

      int doWhat = _doNothing;
      double sarUp = iCustom(NULL,0,"Parabolic SAR of KAMA 1_5","",AccStep,AccLimit,AmaPeriod,AmaPrice,FastEnd,SlowEnd,SmoothPower,JurikFDAdaptive,0,BarToUse);
      double sarDn = iCustom(NULL,0,"Parabolic SAR of KAMA 1_5","",AccStep,AccLimit,AmaPeriod,AmaPrice,FastEnd,SlowEnd,SmoothPower,JurikFDAdaptive,1,BarToUse+1);
     
      double macdUp= iCustom(NULL,0,"Macd - std normalized 1_2 histo","",FastMAPeriod,SlowMAPeriod,SignalPeriod,StdPeriod,Price,Filter,FilterPeriod,ColorChangeOn,0,BarToUse);
      double macdDn= iCustom(NULL,0,"Macd - std normalized 1_2 histo","",FastMAPeriod,SlowMAPeriod,SignalPeriod,StdPeriod,Price,Filter,FilterPeriod,ColorChangeOn,1,BarToUse+1);
     
      if (sarUp!=sarDn & macdUp!=macdDn)
         if (sarUp==1 & macdUp==1) //buy
               doWhat = _doBuy;
         else  doWhat = _doSell;
         if (doWhat==_doNothing && !DisplayInfo) return(0);

        


Follow EA attached.

Thank you

Rogério

Rogério


It is not correct

First parameter of the "Parabolic SAR of KAMA 1_5" is not a string (you used "") but an integer. The same goes for "Macd - std normalized 1_2 histo",

 
mladen:

Rogério


It is not correct

First parameter of the "Parabolic SAR of KAMA 1_5" is not a string (you used "") but an integer. The same goes for "Macd - std normalized 1_2 histo",

Mladen,

I changed the parameter to 0 but unfortunately still does not work.

Do not open any order.


Hull variation tested in various timeframes but often it goes in the wrong direction and lose a lot of money.

I need a filter to solve the false signals.


Unfortunately it is not possible to post the whole code it exceeds the limit.

Thank you.

//+------------------------------------------------------------------+
//|                                 Parabolic_Macd_RB_EA_V1.mq4      |
//|                            Rogério Borges, Copyright 2016        |
//|                                          rogeriob28@gmail.com    |
//+------------------------------------------------------------------+
#property copyright "Rogerio Borges,Copyright 2016"
#property link      "rogeriob28@gmail.com"
// You Need Custom Indicator named <HMA Color nrp>.
enum enPrices
{
   pr_close,      // Close
   pr_open,       // Open
   pr_high,       // High
   pr_low,        // Low
   pr_median,     // Median
   pr_typical,    // Typical
   pr_weighted,   // Weighted
   pr_average,    // Average (high+low+open+close)/4
   pr_medianb,    // Average median body (open+close)/2
   pr_tbiased,    // Trend biased price
   pr_haclose,    // Heiken ashi close
   pr_haopen ,    // Heiken ashi open
   pr_hahigh,     // Heiken ashi high
   pr_halow,      // Heiken ashi low
   pr_hamedian,   // Heiken ashi median
   pr_hatypical,  // Heiken ashi typical
   pr_haweighted, // Heiken ashi weighted
   pr_haaverage,  // Heiken ashi average
   pr_hamedianb,  // Heiken ashi median body
   pr_hatbiased   // Heiken ashi trend biased price
};

enum enDisplayType
{
   dt_disSar,  // Display SAR value
   dt_disAma,  // Display Kaufman ama value
   dt_disAll   // Display both
};
enum colorOn
{
   clrOnSlope, //Color change on slope change
   clrOnZero,  // Color change on zero cross
   clrOnSign   // Color change on signal cross
};

extern string Comentario = "Parabolic EA v1 ";
//extern int    MagicNumber = 123456;  // Magic number to use for the EA
extern bool   EcnBroker   = false;   // Is your broker ECN/STP type of broker?
extern double LotSize     = 1;     // Lot size to use for trading
extern int    Slippage    = 1;       // Slipage to use when opening new orders
extern double StopLoss    = 10;     // Initial stop loss (in pips)
extern double TakeProfit  = 10;     // Initial take profit (in pips)
extern string EA_Texto4                = "==== Fechamento de Ordens ====";
extern bool UsarTPVirtual              = false;
extern float   TPVirtual               = 5;
extern string EA_Texto8a               = "==== Trailing Stop ====";
extern bool UsarTrailingStop           = true;
extern int     TrailingStop = 2;
extern string dummy1      = "";      // .
extern string dummy2      = "";      // Settings for indicators
extern int    BarToUse    = 1;       // Bar to test (0, for still opened, 1 for first closed, and so on)
extern string     IndicatorsSettings   = "===== INDICATORS SETTINGS=====";
extern string     _Indicator           = "===== Parabolic SAR =====";
extern double    AccStep         = 0.02;      // Accumulation step
extern double    AccLimit        = 0.2;       // Accumulation limit
extern int       AmaPeriod       = 10;        // Kaufman AMA period
extern enPrices  AmaPrice        = pr_close;  // Price to be used by Kaufman AMA
extern double    FastEnd         = 2;         // Kaufman AMA fast end
extern double    SlowEnd         = 30;        // Kaufman AMA slow end
extern double    SmoothPower     = 2;         // Smooth power
extern bool      JurikFDAdaptive = true;      // Should the Kaufman AMA be Jurik fractal dimension adaptive?
extern enDisplayType DisplayType = dt_disSar; // What should be displayed?
extern int       LineWidth       = 2;         // Lines width
extern int       ArrowsWidth     = 0;         // Arrows (dots) width
extern bool      Interpolate     = true;      // Interpolate in multi time frame mode?
extern string PARAMETERS_INDICATOR_TWO = "Macd";
extern int                FastMAPeriod  = 23;            // Fast macd period
extern int                SlowMAPeriod  = 50;            // Slow macd period
extern int                SignalPeriod  = 9;             // Signal period
extern int                StdPeriod     = 50;            // Standard deviation used for normalization
extern ENUM_APPLIED_PRICE Price         = PRICE_CLOSE;   // Price to use
extern double             Filter        = 0;             // Filter to apply to macd value
extern int                FilterPeriod  = 0;             // Filter period to use (<= to use the slow macd period)
extern colorOn            ColorChangeOn = clrOnSlope;    // Color change on :

extern string dummy3      = "";      // .
extern string dummy4      = "";      // General settings
extern bool   DisplayInfo = true;    // Dislay info

bool dummyResult;
double ponto;
extern int      MagicNumber = 1234567;
extern bool     AutoMagic = TRUE;//Generate Magic Number based on Symbol and Long/Short params
bool     TradeLong  = TRUE;
bool     TradeShort = TRUE;
int      MagicNumber_Old;
bool     AutoMagic_Old;
bool     TradeLong_Old;
bool     TradeShort_Old;
int     F_MA_TimeFrame=0;
//EA name
string  EANAME="Parabolic";
string  EASHORTNAME="Parabolic";
int    digit = 0;
double PointRatio = 1;
double myPoint;
string s_symbol;
bool diStcBuy = false;
bool diStcSell = false;



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

int init()  
{
AutoMagic();//Done here for immediate update
    //Calculo de Ponto
   if (Point == 0.00001) ponto = 0.0001;
   else {
      if (Point == 0.001) ponto = 0.01;
      else ponto = Point;
   }
//novo cauculo de ponto
   s_symbol = Symbol();
   digit  = MarketInfo(s_symbol,MODE_DIGITS);
   if (digit==2 || digit==4) PointRatio = 1;
   if (digit==3 || digit==5) PointRatio = 10;
   if (digit==6)             PointRatio = 100;
   myPoint  = MarketInfo(s_symbol,MODE_POINT) * PointRatio;
return(0);
}
int deinit() { return(0); }

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

#define _doNothing 0
#define _doBuy     1
#define _doSell    2
int start()
{
   //MagicWarning();//Display a warning in case MagicNumber is changed
   AutoMagic();//Generate Magic Number based on Symbol and Long/Short params
  
      int doWhat = _doNothing;
      double sarUp = iCustom(NULL,0,"Parabolic SAR of KAMA 1_5",0,AccStep,AccLimit,AmaPeriod,AmaPrice,FastEnd,SlowEnd,SmoothPower,JurikFDAdaptive,0,BarToUse);
      double sarDn = iCustom(NULL,0,"Parabolic SAR of KAMA 1_5",0,AccStep,AccLimit,AmaPeriod,AmaPrice,FastEnd,SlowEnd,SmoothPower,JurikFDAdaptive,1,BarToUse+1);
     
      double macdUp= iCustom(NULL,0,"Macd - std normalized 1_2 histo",0,FastMAPeriod,SlowMAPeriod,SignalPeriod,StdPeriod,Price,Filter,FilterPeriod,ColorChangeOn,0,BarToUse);
      double macdDn= iCustom(NULL,0,"Macd - std normalized 1_2 histo",0,FastMAPeriod,SlowMAPeriod,SignalPeriod,StdPeriod,Price,Filter,FilterPeriod,ColorChangeOn,1,BarToUse+1);
     
      if (sarUp!=sarDn & macdUp!=macdDn)
         if (sarUp==1 & macdUp==1) //buy
               doWhat = _doBuy;
         else  doWhat = _doSell;
         if (doWhat==_doNothing && !DisplayInfo) return(0);
        
   //
   //
   //
   //
   //
 
   int    openedBuys    = 0;
   int    openedSells   = 0;
   double currentProfit = 0;
   if(UsarTrailingStop) TrailingStoprb(); //TrailingStop();
     
   ModifyOrders();
   for (int i = OrdersTotal()-1; i>=0; i--)
   {
      if (!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) continue;
      if (OrderSymbol()      != Symbol())            continue;
      if (OrderMagicNumber() != MagicNumber)         continue;

      //
      //
      //
      //
      //
     
      if (DisplayInfo) currentProfit += OrderProfit()+OrderCommission()+OrderSwap();
        
         //
         //
         //
         //
         //
        
         if (OrderType()==OP_BUY)
            if (doWhat==_doSell && diStcSell==true)
                  { RefreshRates(); if (!OrderClose(OrderTicket(),OrderLots(),Bid,Slippage,Orange)) openedBuys++; }
            else  openedBuys++;
         if (OrderType()==OP_SELL)
            if (doWhat==_doBuy & diStcBuy==true)
                  { RefreshRates(); if (!OrderClose(OrderTicket(),OrderLots(),Ask,Slippage,Green)) openedSells++; }
            else  openedSells++;           
   }
   if (DisplayInfo) Comment("Current profit : "+DoubleToStr(currentProfit,2)+" "+AccountCurrency()); if (doWhat==_doNothing) return(0);

   //
   //
   //
   //
   //

   if (doWhat==_doBuy && diStcBuy==true && openedBuys==0)
      {
         RefreshRates();
         //double BStopLossLevel   = Ask - StopLoss   *myPoint;
         //double BTakeProfitLevel = Ask + TakeProfit *myPoint;              
         double stopLossBuy   = 0; if (StopLoss>0)   stopLossBuy   =Ask - StopLoss   *myPoint; //Ask-StopLoss*Point*MathPow(10,Digits%2);
         double takeProfitBuy = 0; if (TakeProfit>0) takeProfitBuy =Ask + TakeProfit *myPoint; //Ask+TakeProfit*Point*MathPow(10,Digits%2);
         if (EcnBroker)
         {
            int ticketb = OrderSend(Symbol(),OP_BUY,LotSize,NormalizeDouble(Ask,digit),Slippage*myPoint,0,0,EASHORTNAME+"_"+Symbol()+"("+GetChartTimeFrame()+")_B",MagicNumber,0,Blue);
            if (ticketb>-1)
               dummyResult = OrderModify(ticketb,OrderOpenPrice(),NormalizeDouble(stopLossBuy,digit),NormalizeDouble(takeProfitBuy,digit),0,CLR_NONE);
             
             
         }
         else dummyResult = OrderSend(Symbol(),OP_BUY,LotSize,NormalizeDouble(Ask,digit),Slippage*myPoint,NormalizeDouble(stopLossBuy,digit),NormalizeDouble(takeProfitBuy,digit),EASHORTNAME+"_"+Symbol()+"("+GetChartTimeFrame()+")_B",MagicNumber,0,Blue);
         
      }
   if (doWhat==_doSell && diStcSell==true && openedSells==0)
      {
         RefreshRates();
         //double SStopLossLevel   = Bid + StopLoss   *Mypoint;
         //double STakeProfitLevel = Bid - TakeProfit *Mypoint;
         double stopLossSell   = 0; if (StopLoss>0)   stopLossSell=Bid + StopLoss   *myPoint; //Bid+StopLoss*Point*MathPow(10,Digits%2);
         double takeProfitSell = 0; if (TakeProfit>0) takeProfitSell =Bid - TakeProfit *myPoint; //Bid-TakeProfit*Point*MathPow(10,Digits%2);
         if (EcnBroker)
         {
            int tickets = OrderSend(Symbol(),OP_SELL,LotSize,NormalizeDouble(Bid,digit),Slippage*myPoint,0,0,EASHORTNAME+"_"+Symbol()+"("+GetChartTimeFrame()+")_S",MagicNumber,0,Red);
            if (tickets>-1)
                dummyResult = OrderModify(tickets,OrderOpenPrice(),NormalizeDouble(stopLossSell,digit),NormalizeDouble(takeProfitSell,digit),0,CLR_NONE);
         }
        
         else dummyResult = OrderSend(Symbol(),OP_SELL,LotSize,NormalizeDouble(Bid,digit),Slippage*myPoint,NormalizeDouble(stopLossSell,digit),NormalizeDouble(takeProfitSell,digit),EASHORTNAME+"_"+Symbol()+"("+GetChartTimeFrame()+")_S",MagicNumber,0,Red);
      }
   return(0);
}