Page 156 of 180

Re: Coding Help

Posted: Mon Dec 11, 2023 6:45 pm
by DaffyTaffy
DaffyTaffy wrote: Mon Dec 11, 2023 8:53 am Hi Mr.Tools. Here's the MT5 version of the ADR indicator.
Am I allowed to share the source code for my MT5 version? I noticed some code in the original file for protecting the name from being changed so I'm unsure.


Regards,
DaffyTaffy

XARD: Yes, by all means... share:-)
Here's the source code since I got the go ahead. I'll be looking to contribute more to this forum.

Re: Coding Help

Posted: Mon Dec 18, 2023 11:58 pm
by pin12
Hello

Could a programmer modify the indicator NADARAYA ENVELOPE so that it is continually updated in the graphic please?
Thanks ..

Re: Coding Help

Posted: Tue Dec 19, 2023 3:29 am
by mrtools
pin12 wrote: Mon Dec 18, 2023 11:58 pm Hello

Could a programmer modify the indicator NADARAYA ENVELOPE so that it is continually updated in the graphic please?
Thanks ..
Image
Try here

Re: Coding Help

Posted: Tue Dec 19, 2023 6:07 am
by pin12
mrtools wrote: Tue Dec 19, 2023 3:29 am Try here
Thank you MrTools for the response, but unfortunately that version does not have the same values as the one I sent to be repaired. It looks different and the envelopes do not appear in 5 minutes, which should be used in the strategy... post1295530071.html#p1295530071

Re: Coding Help

Posted: Fri Dec 29, 2023 8:00 am
by rafael.rpd
Hi guys, I swear I'm trying to train my coding and trying a simple hilo EA that with each new bar close signal above or below the indicator it checks how many signals (be above or below) there were in the last X previous bars (only bars independing the time) and if this number of signals/toggle is greater than Y in the range of X bars make the trade, else not, and check it again each new signal.

I'm new to this but I SWEAR I've been trying for DAYS, I've tried all the searches and even chatGPT (useless I think lol). I know it must be something simple to do, but I feel like when I get it right on one side I get it wrong on the other haha. I will attach part of the code below with the function that I call for this "check".

Any help would be welcome. Thank you very much in advance!! And sorry for the rusty english…

Code: Select all

void OnTick()
  {
      handleHilo = iCustom(Symbol(), Period(), "GannHilo", Periodo);
           // Cópia dos buffers dos indicadores de média móvel com períodos curto e longo

      ArraySetAsSeries(hilo, true);
      ArraySetAsSeries(rates, true);

       
    CopyBuffer(handleHilo, 0, 0, 50, hilo);
    CopyRates(Symbol(), Period(), 0, 50, rates);
  
//---
      if(HorarioEntrada())
   {
      // Compra em caso de cruzamento da média curta para cima da média longa
   if(rates[1].close > hilo[1] && rates[2].close < hilo[2] && HabilitarCompra == true){
      

                  bool alternador = VerificarPrecoAcimaDoHiLo();
               if (alternador) {
                 // Prossiga com a ordem de compra
                 CloseAllSellPositions();
                 Compra();
                 Print("#############SINAIS TROCADOS NAS ULTIMAS BARRAS###################: ", contadorTrocas);
                 HabilitarCompra = false;
                 HabilitarVenda = true;
                 contadorTrocas = 0;
             }
         }
   
                     // Venda em caso de cruzamento da média curta para baixo da média longa
        if(rates[1].close < hilo[1] && rates[2].close > hilo[2] && HabilitarVenda == true){
                  

                  bool alternador = VerificarPrecoAcimaDoHiLo();
               if (alternador)   {
                 // Prossiga com a ordem de venda
                     CloseAllBuyPositions();
                     Venda();
                     Print("#############SINAIS TROCADOS NAS ULTIMAS BARRAS###################: ", contadorTrocas);
                     HabilitarVenda = false;
                     HabilitarCompra = true;
                     contadorTrocas = 0;
                     }
               }
         }

Code: Select all

bool VerificarPrecoAcimaDoHiLo() {
    for (int i = 0; i < intervaloBarras; i++) {
        // Verifica se o preço de fechamento de cada barra está acima do valor HiLo correspondente
        if (rates[i].close > hilo[i] && rates[i+1].close < hilo[i+1]) {
            contadorTrocas++; // Pelo menos uma barra fechou abaixo do HiLo
        }
        else if(rates[i].close < hilo[i] && rates[i+1].close > hilo[i+1]){
            contadorTrocas++;
      }
   }
            if(contadorTrocas > alternanciaMinima){
               return true;
               }
                  else{
                     contadorTrocas = 0;
                     return false;
                  }
               
}
I don't know if I should make an ARRAY or if just doing a correctly FOR would be enough... Thanks again!

Re: Coding Help

Posted: Thu Jan 18, 2024 7:34 pm
by md2008
Hello

Could a programmer add an alert for this one thank you so much :)

Re: Coding Help

Posted: Thu Jan 18, 2024 7:45 pm
by Ogee
md2008 wrote: Thu Jan 18, 2024 7:34 pm Hello

Could a programmer add an alert for this one thank you so much :)
Hi, the coders would need the .mq4 version, they are unable to work on the .ex version.

Re: Coding Help

Posted: Thu Jan 18, 2024 7:45 pm
by Ogee
md2008 wrote: Thu Jan 18, 2024 7:34 pm Hello

Could a programmer add an alert for this one thank you so much :)
Hi, the coders would need the .mq4 version, they are unable to work on the .ex version.

Re: Coding Help

Posted: Thu Jan 18, 2024 7:56 pm
by md2008
Ogee wrote: Thu Jan 18, 2024 7:45 pm Hi, the coders would need the .mq4 version, they are unable to work on the .ex version.
soory i dont have it

Re: Coding Help

Posted: Thu Jan 18, 2024 8:13 pm
by Ogee
md2008 wrote: Thu Jan 18, 2024 7:56 pm soory i dont have it
try this one;