PESSOAL ALGUEM PODE ME AJUDAR COM MEU CODIGO!

 

PESSOAL ALGUEM PODE ME AJUDAR COM MEU CODIGO! NAO CONSIGO DA UM INTERVALO DE  X MINUTOS ENTRE UM SINAL E OUTRO

EX: APOS ELE DAR O SINAL , DEPOIS DISSO ELE FICARA 5 MINUTOS SEM DAR SINAL, DEPOIS DESSE TEMPO ELE VOLTA AO SEU ESTADO NORMAL DE OPERAÇÃO .




int OnCalculate(const int rates_total,

                const int prev_calculated,

                const datetime& time[],

                const double& open[],

                const double& high[],

                const double& low[],

                const double& close[],

                const long& tick_volume[],

                const long& volume[],

                const int& spread[])

  {

   int limit = rates_total - prev_calculated;

   //--- counting from 0 to rates_total

   ArraySetAsSeries(Buffer1, true);

   ArraySetAsSeries(Buffer2, true);

   //--- initial zero

   if(prev_calculated < 1)

     {

      ArrayInitialize(Buffer1, 0);

      ArrayInitialize(Buffer2, 0);

     }

   else

      limit++;

   

   if(TrendlinePriceUpper(0) < 0 && TrendlinePriceLower(0) < 0) return;

   //--- main loop

   for(int i = limit-1; i >= 0; i--)

     {

      if (i >= MathMin(60-1, rates_total-1-50)) continue; // omita algumas taxas antigas para evitar "Matriz fora da faixa" ou cálculo lento 

      

      

      

      //Indicator Buffer 1

    if(Close[i] < TrendlinePriceLower(i)

      && Close[i+1] > TrendlinePriceLower(i+1) //Candlestick Close crosses below Lower Trendline

      )

      

      

        {

         Buffer1[i] = Low[i]; // Defina o valor do indicador como Candlestick Low

         if(i == 0 && Time[0] != time_alert)

          { myAlert("indicator", "Buy"); time_alert = Time[0];} // Alerta instantâneo, apenas uma vez por barra

        

        

      

        

        

        }

  

        

      //Indicator Buffer 2

      

      if(Close[i] > TrendlinePriceUpper(i)

      && Close[i+1] < TrendlinePriceUpper(i+1) //Candlestick Close crosses above Upper Trendline

      )

        {

         Buffer2[i] = High[i]; //Set indicator value at Candlestick High

         if(i == 0 && Time[0] != time_alert) { myAlert("indicator", "Sell"); time_alert = Time[0]; } //Instant alert, only once per bar

        }

        

        

        

        

     }

   return(rates_total);

  }

//+------------------------------------------------------------------+
 
marcos santos:
I HAVE A PROBLEM IN THAT CODE CAN'T MAKE SOMETHING AFTER GIVING THE SIGN IT GETS DURING 5 MINUTES WITHOUT SENDING ANYTHING, A PAUSE





int OnCalculate(const int rates_total,

                const int prev_calculated,

                const datetime& time[],

                const double& open[],

                const double& high[],

                const double& low[],

                const double& close[],

                const long& tick_volume[],

                const long& volume[],

                const int& spread[])

  {

   int limit = rates_total - prev_calculated;

   //--- counting from 0 to rates_total

   ArraySetAsSeries(Buffer1, true);

   ArraySetAsSeries(Buffer2, true);

   //--- initial zero

   if(prev_calculated < 1)

     {

      ArrayInitialize(Buffer1, 0);

      ArrayInitialize(Buffer2, 0);

     }

   else

      limit++;

   

   if(TrendlinePriceUpper(0) < 0 && TrendlinePriceLower(0) < 0) return;

   //--- main loop

   for(int i = limit-1; i >= 0; i--)

     {

      if (i >= MathMin(60-1, rates_total-1-50)) continue; // omita algumas taxas antigas para evitar "Matriz fora da faixa" ou cálculo lento 

      

      

      

      //Indicator Buffer 1

    if(Close[i] < TrendlinePriceLower(i)

      && Close[i+1] > TrendlinePriceLower(i+1) //Candlestick Close crosses below Lower Trendline

      )

      

      

        {

         Buffer1[i] = Low[i]; // Defina o valor do indicador como Candlestick Low

         if(i == 0 && Time[0] != time_alert)

          { myAlert("indicator", "Buy"); time_alert = Time[0];} // Alerta instantâneo, apenas uma vez por barra

        

        

      

        

        

        }

  

        

      //Indicator Buffer 2

      

      if(Close[i] > TrendlinePriceUpper(i)

      && Close[i+1] < TrendlinePriceUpper(i+1) //Candlestick Close crosses above Upper Trendline

      )

        {

         Buffer2[i] = High[i]; //Set indicator value at Candlestick High

         if(i == 0 && Time[0] != time_alert) { myAlert("indicator", "Sell"); time_alert = Time[0]; } //Instant alert, only once per bar

        }

        

        

        

        

     }

   return(rates_total);

  }

//+------------------------------------------------------------------+

Olá, Marcos você está no Fórum Português, pode escrever em nosso idioma.

Por favor adiciona seu código na aba Codigo atalho (Alt+s)


Hello Marcos you are in Forum Portugues, you can write in our language.

Please add your code in the Shortcut Code tab (Alt + s)

 
Davi Silva:

Olá, Marcos você está no Fórum Português, pode escrever em nosso idioma.

Por favor adiciona seu código na aba Codigo atalho (Alt+s)


Hello Marcos you are in Forum Portugues, you can write in our language.

Please add your code in the Shortcut Code tab (Alt + s)

OI DAVI OBRIGADO AMIGO!! ESCREVI EM PORTUGUÊS!! VÊ SE VOCÊ CONSEGUE ME AJUDAR POR FAVOR! JA TENTEI VARIAS MANEIRA MAIS NAO ESTOU CONSEGUINDO.
 
marcos santos:
OI DAVI OBRIGADO AMIGO!! ESCREVI EM PORTUGUÊS!! VÊ SE VOCÊ CONSEGUE ME AJUDAR POR FAVOR! JA TENTEI VARIAS MANEIRA MAIS NAO ESTOU CONSEGUINDO.

A menos que você tenha alguma deficiência visual, PARE de escrever tudo em MAIÚSCULAS!


E, seu código está incompleto...

Ninguém consegue saber de onde vem "time_alert" ou as demais referências de se código.

Esse código é "seu"?

 
Flavio Jarabeck:

A menos que você tenha alguma deficiência visual, PARE de escrever tudo em MAIÚSCULAS!


E, seu código está incompleto...

Ninguém consegue saber de onde vem "time_alert" ou as demais referências de se código.

Esse código é "seu"?

   Olá, meus amigos, como vão vcs?

  

   Barbaridade tchê! Vamos lá:

   

//Em cima, na boca do lobo:

datetime sLastAlert = 0;
int sBarrasDif = 6; //Diferença entre os sinais


//Vamos criar uma função com retorno do intervalo em barras:

int sDifBar(datetime previous, datetime now){
     
     double dif = 0;
     double sper = PeriodSeconds();
     int a = (int) now;
     int b = (int) previous;
     int c = a-b;
     int d = c/sper;
     
     d<0? d = d*-1: d=d;

     return(d); //Retorno com a diferença em barras
}

//Nos eventos:

   if(sDifBar(TimeCurrent(), sLastAlert) >= 6) { //Se maior que números de barras segue o samba

   string KillTheSogra = "Matei minha sogra a " + sDifBar(TimeCurrent(), sLastAlert) + "barras atrás";
   
   sLastAlert = TimeCurrent();

   }

//======================^-^==========================


    FLW!

   

Razão: