Re: Metatrader 5 Versions of indicators.

62
baraozemo wrote: Sat Apr 22, 2017 4:22 am Hi mladen,

I use this component in my template and in a test EA...
but while in graphic it has some glitches (the component is slow and does not update the screen correctly)
and while using the EA also gives the same problem and also leaves the backtest very very slow...
Could you help me to optimize and fix this component it's crucial to me?
The BarsCalculated() returns the number of calculated bars - not the not calculated/changed
The correct math for the new calculated bars should be Bars(_Symbol,_Period)-BarsCalculated(handle);

Try that out

Re: Metatrader 5 Versions of indicators.

64
Hi,
I need help with bb.

I want to detect the "bollingers bands" opening in the mt5, (see graphic)
the code samples that I have only get Touch or break in bb with the price, but it's not I need,
I need to get the "BB" opening like in this graphic.

Code: Select all

   int               m_BBHand;         
   double            m_BBup[];
   double            m_BBlow[];
   double            m_BBmidle[];    
   MqlRates          m_BBrate[];          // To be used to store the prices, volumes and spread of each bar   

int OnInit()
{
      m_BBHand=iBands(_Symbol,BB_TimeFrame,BB_Period,BB_Shift,BB_deviation,PRICE_CLOSE);
      ChartIndicatorAdd(0,(int)ChartGetInteger(1,CHART_WINDOWS_TOTAL),m_BBHand);

}

void OnTick()
{
         ArraySetAsSeries(m_BBrate,true);
        
         ZeroMemory(m_BBup);
         ZeroMemory(m_BBlow);
         ZeroMemory(m_BBmidle);         
         ArraySetAsSeries(m_BBup,true);
         ArraySetAsSeries(m_BBlow,true);
         ArraySetAsSeries(m_BBmidle,true);
         if(CopyRates(_Symbol,BB_TimeFrame,0,3,m_BBrate)<0)
           {
            return(false);
           }
         if(CopyBuffer(m_BBHand,0,1,3,m_BBmidle)<0 || 
            CopyBuffer(m_BBHand,1,1,3,m_BBup)<0 || 
            CopyBuffer(m_BBHand,2,1,3,m_BBlow)<0)
            {
            return(false);
            }           
         }       

      bool  buyreg,sellreg=false;

         //but  this code get candle crossing the bands (and it's not that I need)
         ///I need is only to get the "bands opening" (see the attached graphic) 
            buyreg=m_BBrate[1].close>m_BBlow[1] && m_BBrate[1].open<m_BBlow[1];// White (bull) candle crossed the Lower Band from below to above
           sellreg=m_BBrate[1].close<m_BBup[1]&& m_BBrate[1].open>m_BBup[1];// Black (bear) candle crossed the Upper Band from above to below
}

Re: Metatrader 5 Versions of indicators.

65
baraozemo wrote: Wed Apr 26, 2017 5:18 am Hi,
I need help with bb.

I want to detect the "bollingers bands" opening in the mt5, (see graphic)
the code samples that I have only get Touch or break in bb with the price, but it's not I need,
I need to get the "BB" opening like in this graphic.

Code: Select all

   int               m_BBHand;         
   double            m_BBup[];
   double            m_BBlow[];
   double            m_BBmidle[];    
   MqlRates          m_BBrate[];          // To be used to store the prices, volumes and spread of each bar   

int OnInit()
{
      m_BBHand=iBands(_Symbol,BB_TimeFrame,BB_Period,BB_Shift,BB_deviation,PRICE_CLOSE);
      ChartIndicatorAdd(0,(int)ChartGetInteger(1,CHART_WINDOWS_TOTAL),m_BBHand);

}

void OnTick()
{
         ArraySetAsSeries(m_BBrate,true);
        
         ZeroMemory(m_BBup);
         ZeroMemory(m_BBlow);
         ZeroMemory(m_BBmidle);         
         ArraySetAsSeries(m_BBup,true);
         ArraySetAsSeries(m_BBlow,true);
         ArraySetAsSeries(m_BBmidle,true);
         if(CopyRates(_Symbol,BB_TimeFrame,0,3,m_BBrate)<0)
           {
            return(false);
           }
         if(CopyBuffer(m_BBHand,0,1,3,m_BBmidle)<0 || 
            CopyBuffer(m_BBHand,1,1,3,m_BBup)<0 || 
            CopyBuffer(m_BBHand,2,1,3,m_BBlow)<0)
            {
            return(false);
            }           
         }       

      bool  buyreg,sellreg=false;

         //but  this code get candle crossing the bands (and it's not that I need)
         ///I need is only to get the "bands opening" (see the attached graphic) 
            buyreg=m_BBrate[1].close>m_BBlow[1] && m_BBrate[1].open<m_BBlow[1];// White (bull) candle crossed the Lower Band from below to above
           sellreg=m_BBrate[1].close<m_BBup[1]&& m_BBrate[1].open>m_BBup[1];// Black (bear) candle crossed the Upper Band from above to below
}
Snap1.png
baraozemo

What would be the exact criteria for "opening"?


Re: Metatrader 5 Versions of indicators.

66
hi,
I think that we can mesure the angle of the bb_bands_High and bb_bands_Low.

I will have two signals:
1) BB is opening the mouth (The price is walking, non-lateral market)
if the angle of bb_bands_high is > 45º
and the angle of bb_bands_low > 45º
the bb is opening the mouth...
(see graph)

2) Check is the price is falling or growing up (buy and sell signal)

Re: Metatrader 5 Versions of indicators.

67
baraozemo wrote: Wed Apr 26, 2017 6:24 am hi,
I think that we can mesure the angle of the bb_bands_High and bb_bands_Low.

I will have two signals:
1) BB is opening the mouth (The price is walking, non-lateral market)
if the angle of bb_bands_high is > 45º
and the angle of bb_bands_low > 45º
the bb is opening the mouth...
(see graph)

2) Check is the price is falling or growing up (buy and sell signal)

Snap1.png
baraozemo

You can not calculate the angle on a price time series
Some other criteria should be used


Who is online

Users browsing this forum: Grapeshot [Bot] and 7 guests