Download MetaTrader 5

Double Max and Double Min:

To add comments, please log in or register
texoro
126
texoro 2016.08.24 17:09 

 Hello everyone, I have the following function that gives me a allert when when you come to form the double up and double min:

 

void DoppioMinMax(int DistanzaFrecciaRib=5, int DistanzaFrecciaRia=5, )
{
  int dpmindmax =0;
  int i, countDmax=0, countdpmin=0;
   for (i = Bars-10; i >= 0; i--) 
    {
     
    // CercoDoppioMassimo
     if (Close[i+2]>Open[i+2] && Close[i+1]<Open[i+1] && Close[i+2]<=(Open[i+1]+Margine*Poin) && Close[i+2]>=(Open[i+1]-Margine*Poin)){
         DoppioMassimo[i+1]=High[i+1]+DistanzaFrecciaRib*Poin;
         dpmindmax=1;
         countDmax++;
         //Alert("Sell su:"+Symbol()+" a TF "+IntegerToString(Period(),0,0));
         if (NuovaCandela()==True)
            Alert("Sell su:"+Symbol()+" a TF "+IntegerToString(Period(),0,0));
            }
    
     if (Close[i+2]<Open[i+2] && Close[i+1]>Open[i+1] && Close[i+2]<=(Open[i+1]+Margine*Poin) && Close[i+2]>=(Open[i+1]-Margine*Poin)){
         DoppioMinimo[i+1]=Low[i+1]-DistanzaFrecciaRia*Poin;
         dpmindmax=2;
         //Alert("Buy su:"+Symbol()+" a TF "+IntegerToString(Period(),0,0));
         countdpmin++;
         if (NuovaCandela()==True)
             Alert("Buy su:"+Symbol()+" a TF "+IntegerToString(Period(),0,0));
                                       }
         
         Comment("doppio max:"+ countDmax +"\ndoppio min:" +countdpmin+"\ndoppiominmax:" +dpmindmax);
       }          
                        
      } 

 The problem is that the function I from the allert each time you that closes a bar even if it is not a double dip or a double top to me would serve the

allert only when there is a double min or a double top, you know help me?

whroeder1
14765
whroeder1 2016.08.25 13:44  
texcs: I get the alert each time a bar closes
  1. Then drop your loop and only look at bars 1 and 2.
  2. Your text is almost incomprehensible. If you are using mechanical translation, you must use simple sentence structure.
texoro
126
texoro 2016.08.25 17:33  
WHRoeder:
texcs: I get the alert each time a bar closes
  1. Then drop your loop and only look at bars 1 and 2.
  2. Your text is almost incomprehensible. If you are using mechanical translation, you must use simple sentence structure.

The problem with this function is that it gives me the alert signal each time you close a candel and it opens a new one;
Instead of this I need to have the alert signal every time it forms a double minus or a double maxium, only in these two cases. 
Fernando Carreiro
2281
Fernando Carreiro 2016.08.25 17:40  
texcs:

The problem with this function is that it gives me the alert signal each time you close a candel and it opens a new one;
Instead of this I need to have the alert signal every time it forms a double minus or a double maxium, only in these two cases. 

WHRoeder has already given you the answer (and you even quoted him), yet you did not do it!

WHRoeder:
texcs: I get the alert each time a bar closes
  1. Then drop your loop and only look at bars 1 and 2.
texoro
126
texoro 2017.02.04 15:21  
  for (i = Bars-10; i >= 0; i--)
    {
    
     // CercoDoppioMassimo
     if (Close[i+2]>Open[i+2] && Close[i+1]<Open[i+1] && Close[i+2]<=(Open[i+1]+Margine*Poin) && Close[i+2]>=(Open[i+1]-Margine*Poin)&& (High[i+2]< High[i+1])&&(Low[i+2]>Low[i+1]))
     {  
    
         DoppioMassimo[i+1]=High[i+1]+DistanzaFrecciaRib*Poin;
         //Alert("Doppio Massimo su "+Symbol()+" a TF "+IntegerToString(Period(),0,0));
     }
    
     if (Close[i+2]<Open[i+2] && Close[i+1]>Open[i+1] && Close[i+2]<=(Open[i+1]+Margine*Poin) && Close[i+2]>=(Open[i+1]-Margine*Poin)&&(Low[i+2]> Low[i+1])&&(High[i+2]<High[i+1])&& (Close[i+1]<Open [i+2]))
     {
      DoppioMinimo[i+1]=Low[i+1]-DistanzaFrecciaRia*Poin;
      //Alert("Doppio Minimo su "+Symbol()+" a TF "+IntegerToString(Period(),0,0));0
     }


double max and double min function has to create a red arrow for any double max and (which do not appear everytime) and 1 green arrow for every double min (which never appear) who help me to fix (i attach the candle which has to recognize the functions)

whroeder1
14765
whroeder1 2017.02.04 16:45  
texoro: who help me to fix
Asked and answered twice.
To add comments, please log in or register