Addio robot - ciao marasma - pagina 5

 
Suggerisco quanto segue: allega l'indicatore (quello che funzionava prima, senza modifiche) qui o nel mio messaggio personale e lo correggerò.
 
Pavlick:
Suggerisco quanto segue: allega l'indicatore (la variante che funzionava prima, senza modifiche) qui o nel mio messaggio personale, lo correggerò.

Ciao, Pavlik!

Questa è la versione.

originale.

prova a trascinare il codice

pansa

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

//| AltrTrend_Signal_v2_2.mq4

//| Ramdass - Solo conversione

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

#property copyright "Autore - OlegVS, GOODMAN"

#proprietà indicator_chart_window

#proprietà indicator_buffers 2

#property indicator_color1 Chartreuse

#proprietà indicator_color2 Giallo

#proprietà indicator_width1 2

#proprietà indicator_width2 2

//---- parametri di ingresso

extern int K=30;

extern double Kstop=0.5;

extern inttern Kperiod=150;

extern inttern PerADX=14;

extern inttern CountBars=350;

extern intON=1; //zakton's

//---- buffer

doppio val1[];

doppio val2[];

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

//| funzione di inizializzazione dell'indicatore personalizzato

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

int init()

{

stringa short_name;

//----linea di indicazione

IndicatorBuffers(2);

SetIndexStyle(0,DRAW_ARROW);

SetIndexArrow(0,159);

SetIndexStyle(1,DRAW_ARROW);

SetIndexArrow(1,159);

SetIndexBuffer(0,val1);

SetIndexBuffer(1,val2);

//----

ritorno(0);

}

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

//| AltrTrend_Signal_v2_2|

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

int start()

{

se (CountBars>=Bars) CountBars=Bars;

SetIndexDrawBegin(0,Bars-CountBars+PerADX);

SetIndexDrawBegin(1,Bars-CountBars+PerADX);

int i,shift,counted_bars=IndicatorCounted();

int i1,i2;

doppio Range, AvgRange, smin, smax, SsMax, SsMin, SSP, prezzo;

bool uptrend,old;

//----

se(Bars<=PerADX+1) return(0);

//---- zero iniziale

se(barre contate<PerADX+1)

{

for(i=1;i<=PerADX;i++) val1[CountBars-i]=0.0;

for(i=1;i<=PerADX;i++) val2[CountBars-i]=0.0;

}

//----

per (shift = CountBars-PerADX; shift>=0; shift--)

{

SSP=MathCeil(Kperiod/iADX(NULL,0,PerADX,PRICE_CLOSE,MODE_MAIN,1));

Gamma=0;

AvgRange=0;

for (i1=shift; i1<=shift+SSP; i1++)

{AvgRange=AvgRange+MathAbs (High[i1]-Low[i1]);

}

Range=AvgRange/(SSP+1);

SsMax=High[shift]; SsMin=Low[shift];

for (i2=shift;i2<=shift+SSP-1;i2++)

{

prezzo=Alto[i2];

if(SsMax<prezzo) SsMax=prezzo;

prezzo=Basso[i2];

se(SsMin>=prezzo) SsMin=prezzo ;

}

smin = SsMin+(SsMax-SsMin)*K/100;

smax = SsMax-(SsMax-SsMin)*K/100;

val1[shift]=0;

val2[shift]=0;

se (Close[shift]<smin)

{

uptrend = falso;

}

se (Close[shift]>smax)

{

uptrend = vero;

}

if (uptrend!=old && uptrend==true) {val1[shift]=Low[shift]-Range*Kstop;}

if (uptrend!=old && uptrend==false) {val2[shift]=High[shift]+Range*Kstop;}

old=uptrend;

// il codice di zakton

se ((shift == 0) && (SoundON == 1)) {

se (val1[0] > 0) PlaySound("ReadyToExit.wav");

}

se ((shift == 0) && (SoundON == 1)) {

se (val2[0] > 0) PlaySound("ReadyToExit.wav");

}

}

ritorno(0);

}

//+--------------------------------------------------------
 
pansa:

Ciao, Pavlik!

Questa è la versione.

originale.

prova a trascinare il codice

pansa


Sr. Pansa! Perché non usi il tasto SRC per mettere il tuo codice? Así mejor o Ud. tiene alguna duda?

//+------------------------------------------------------------------+
//| AltrTrend_Signal_v2_2.mq4
//| Ramdass - Conversion only
//+------------------------------------------------------------------+
#property  copyright "Author - OlegVS, GOODMAN"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Chartreuse
#property indicator_color2 Yellow
#property indicator_width1 2
#property indicator_width2 2
//---- input parameters
extern int K=30;
extern double Kstop=0.5;
extern int Kperiod=150;
extern int PerADX=14;
extern int CountBars=350;
extern int SoundON=1; //zakton's
//---- buffers
double val1[];
double val2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   string short_name;
//---- indicator line
   IndicatorBuffers(2);
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,159);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,159);
   SetIndexBuffer(0,val1);
   SetIndexBuffer(1,val2);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| AltrTrend_Signal_v2_2                                            |
//+------------------------------------------------------------------+
int start()
  {  
   if (CountBars>=Bars) CountBars=Bars;
   SetIndexDrawBegin(0,Bars-CountBars+PerADX);
   SetIndexDrawBegin(1,Bars-CountBars+PerADX);
   int i,shift,counted_bars=IndicatorCounted();
   int i1,i2;
   double Range,AvgRange,smin,smax,SsMax,SsMin,SSP,price;
   bool uptrend,old;
//----
   if(Bars<=PerADX+1) return(0);
//---- initial zero
   if(counted_bars<PerADX+1)
   {
      for(i=1;i<=PerADX;i++) val1[CountBars-i]=0.0;
      for(i=1;i<=PerADX;i++) val2[CountBars-i]=0.0;
   }
//----
for (shift = CountBars-PerADX; shift>=0; shift--)
{
SSP=MathCeil(Kperiod/iADX(NULL,0,PerADX,PRICE_CLOSE,MODE_MAIN,1));
                Range=0;
                AvgRange=0;
                for (i1=shift; i1<=shift+SSP; i1++)
                               {AvgRange=AvgRange+MathAbs(High[i1]-Low[i1]);
                               }
                Range=AvgRange/(SSP+1);
SsMax=High[shift]; SsMin=Low[shift];
   for (i2=shift;i2<=shift+SSP-1;i2++)
        {
         price=High[i2];
         if(SsMax<price) SsMax=price;
         price=Low[i2];
         if(SsMin>=price)  SsMin=price;
        }
smin = SsMin+(SsMax-SsMin)*K/100;
smax = SsMax-(SsMax-SsMin)*K/100;
                val1[shift]=0;
                val2[shift]=0;
                if (Close[shift]<smin)
                               {
                               uptrend = false;
                               }
                if (Close[shift]>smax)
                               {
                               uptrend = true;
                               }
   if (uptrend!=old && uptrend==true) {val1[shift]=Low[shift]-Range*Kstop;}
   if (uptrend!=old && uptrend==false) {val2[shift]=High[shift]+Range*Kstop;}
   old=uptrend;
// zakton's code  
   if ((shift == 0) && (SoundON == 1)) {
      if (val1[0] > 0) PlaySound("ReadyToExit.wav");
   }
   if ((shift == 0) && (SoundON == 1)) {
      if (val2[0] > 0) PlaySound("ReadyToExit.wav");
   }
}
   return(0);
  }
//+--------------------------------------------------------

Buona fortuna!

 
pansa:

Ciao, Pavlik!

Questa è la versione.

originale.

prova a trascinare il codice

pansa




L'indicatore funziona, ma lo sviluppatore ha fatto un errore logico in esso

SSP=MathCeil(Kperiod/iADX(NULL,0,PerADX,PRICE_CLOSE,MODE_MAIN,1));
 
//+------------------------------------------------------------------+
//|                                        sample_execute_script.mq4 |
//+------------------------------------------------------------------+
#import "user32.dll"
  int RegisterWindowMessageW(string MessageName);
  int PostMessageW(int hwnd, int msg, int wparam, string Name);
  void keybd_event(int VirtualKey, int ScanCode, int Flags, int ExtraInfo);


#import

int start()
{
  int winHandle = WindowHandle( Symbol(), Period() );
//
//
//
  if(signal < 0 && trigl==true && buy == true) 
  {
    StartScript(winHandle, "SchliesenProfitOrders" ); 
  }
//
//
//
}
void StartScript(int hWnd, string ScriptName, bool AutomaticallyAcceptDefaults = false)
{
  int MessageNumber = RegisterWindowMessageW("MetaTrader4_Internal_Message");
  PostMessageW(hWnd, MessageNumber, 16, ScriptName);
  if (AutomaticallyAcceptDefaults) { ClearConfigDialog(); }
} 
void ClearConfigDialog()
{
  Sleep(100);
  keybd_event(13, 0, 0, 0);
}
//
//
//
return(0);
Questo è ciò di cui parlava Roche
 

VA BENE?

//+------------------------------------------------------------------+
//|                                             AltrTREND_Signal.mq4 |
//|                        Copyright 2014, MetaQuotes Software Corp. |
//|                                              https://www.mql5.com |
//+------------------------------------------------------------------+


//+------------------------------------------------------------------+
//|                                 AltrTrend_Signal_v2_2_alert.mq4  |
//|                                       Ramdass - Conversion only  |
//+------------------------------------------------------------------+
#property  copyright "Author - OlegVS, GOODMAN"
#property strict
#import "user32.dll"
  int RegisterWindowMessageA(uchar &lParam[]);
  int SendMessageA(int hWnd, int Msg, int wParam, char &lParam[]);
  void keybd_event(int VirtualKey, int ScanCode, int Flags, int ExtraInfo);
#import

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 DeepSkyBlue
#property indicator_color2 OrangeRed
#property indicator_width1 1
#property indicator_width2 1

//---- input parameters
extern bool Alert_message = true;
extern int  Time_alert_minutes = 60; // ????? ????? ?????????? ???? ??? ? 60 ?????.
extern int K = 30;
extern double Kstop = 0.5;
extern int Kperiod = 150;
extern int PeriodADX = 7;//14;
extern int CountBars = 100;
extern string script_name = "fPlayer";

//---- buffers
double val1[];
double val2[];

double AlertTime;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
    //---- indicator line
    IndicatorBuffers(1);
    SetIndexStyle(0,DRAW_ARROW);
    SetIndexArrow(0,241);
    IndicatorBuffers(2);
    SetIndexStyle(1,DRAW_ARROW);
    SetIndexArrow(1,242);
    SetIndexBuffer(0,val1);
    SetIndexBuffer(1,val2);
    if(CountBars>=Bars) 
        CountBars=Bars;
    SetIndexDrawBegin(0, Bars - CountBars + PeriodADX );
    SetIndexDrawBegin(1, Bars - CountBars + PeriodADX );
    //----
    return(0);
  }
  
//+------------------------------------------------------------------+
//| AltrTrend_Signal_v2_2                                            |
//+------------------------------------------------------------------+
int start()
{   
    int shift, counted_bars = IndicatorCounted();
    //---- 
    if(counted_bars<0) return(-1);
    //---- 
    int i1, i2, t_per;
    double Range, AvgRange, smin, smax, SsMax, SsMin, SSP, price;
    bool uptrend, old;
    //----
    if(Bars <=PeriodADX  + 1) 
        return(0);
    //----
    for(shift = CountBars - PeriodADX ; shift >= 0; shift--) 
    { 
        SSP = MathCeil(Kperiod / iADX(NULL, 0, PeriodADX , PRICE_CLOSE, MODE_MAIN, 1));
        Range = 0;
        AvgRange = 0;
        for(i1 = shift; i1 <= shift + SSP; i1++)
        {
            AvgRange = AvgRange + MathAbs(High[i1] - Low[i1]);
        }
        Range = AvgRange / (SSP + 1);
        //----
        SsMax = High[shift]; 
        SsMin = Low[shift]; 
        for(i2 = shift; i2 <= shift + SSP - 1; i2++)
        {
            price = High[i2];
            if(SsMax < price) 
                SsMax = price;
            price = Low[i2];
            if(SsMin >= price)  
                SsMin = price;
        }
        //----
        smin = SsMin + (SsMax - SsMin)*K / 100; 
        smax = SsMax - (SsMax - SsMin)*K / 100; 
        val1[shift] = 0.0;
        val2[shift] = 0.0;
        if(Close[shift] < smin)
        {
            uptrend = false;
        }
        if(Close[shift] > smax)
        {
            uptrend = true;
        }
        if(uptrend != old && uptrend == true) 
        {
            val1[shift] = Low[shift] - Range*Kstop;
        }
        if(uptrend != old && uptrend == false) 
        {
            val2[shift] = High[shift] + Range*Kstop;
        }
        old = uptrend;
    }  
    
//---- Alert
    if (Period()<Time_alert_minutes) t_per=Period(); else t_per=Time_alert_minutes; // ???? ??<Time_alert, ????? ????? ?????????? ???? ??? ? ??.
    if (Alert_message==true && CurTime()>AlertTime && val1[0]!=0.0)
    { 
        Alert(Symbol()," +++  BUY !!! +++" , "  //AltrTrend_Signal_v2_2_alert");
        AlertTime=CurTime() + (t_per - MathMod(TimeMinute(CurTime()), t_per))*60;
        //PlaySound("payment.wav");
        int winHandle = WindowHandle( Symbol(), Period() );
        StartScript(winHandle, script_name);
    }
    if (Alert_message==true && CurTime()>AlertTime && val2[0]!=0.0)
    { 
        Alert(Symbol()," +++  SELL !!!   +++" , "  //AltrTrend_Signal_v2_2_alert");
        AlertTime=CurTime() + (t_per - MathMod(TimeMinute(CurTime()), t_per))*60;
        // PlaySound("payment.wav");
        int winHandle = WindowHandle( Symbol(), Period() );
        StartScript(winHandle, script_name);
    }

    return(0);
}

void StartScript(int hWnd, string ScriptName, bool AutomaticallyAcceptDefaults = false)
{
    char buf[];
    StringToCharArray("MetaTrader4_Internal_Message", buf);
    int MT4InternalMsg = RegisterWindowMessageA(buf);
    StringToCharArray(ScriptName, buf);
    SendMessageA(hWnd, MT4InternalMsg, 16, buf);
    if (AutomaticallyAcceptDefaults) { ClearConfigDialog(); }
}

void ClearConfigDialog()
{
    Sleep(100);
    keybd_event(13, 0, 0, 0);
} 

//+------------------------------------------------------------------+
 
Pavlick:

VA BENE?


Ciao Pavlik!

Installato il tuo codice...

Funziona perfettamente!

Sei un grande talento -

Hai sfondato il muro!

Ottimo lavoro -

ora segnali affidabili e

# nuovi orizzonti! #

che bella giornata oggi!

Vorrei fare un ringraziamento speciale a Integer.

Ha scritto la sceneggiatura della chiamata del giocatore!

Ci sono, tuttavia, talenti e brave persone.

Complimenti a voi!

Oggi è il 9/11/14!

Panza

 
Andrei01:

La maggior parte dei miei avvertimenti spazzatura sono generati a causa di un passaggio perfettamente legale, corretto e standard di una variabile per riferimento in una funzione quando il nome del template della funzione coincide con la variabile stessa come dovrebbe essere in questo costrutto nel suo uso standard e tipico, quando la variabile stessa viene passata nella funzione con il proprio nome.

Fate un esempio, per favore.

Sfortunatamente, l'MC non poteva dare una spiegazione competente e logica di questo, come a volte qualcuno lì presunto può avere un malinteso in altre costruzioni quando ci sono nomi simili.

Se ho capito bene il caso, la risposta era sia logica che corretta, ed è stata appresa in più di un paio di decenni di programmazione continua.


Scusa per il commento cancellato accidentalmente - ho cliccato sul posto sbagliato e non c'è una funzione per ripristinarlo.

 
Renat:

Mi faccia un esempio, per favore.

Se ho capito bene il caso, la risposta era sia logica che corretta, ed è stata sofferta attraverso più di un paio di decenni di programmazione continua.


//--------------------------------------------------------------------
#property indicator_chart_window
//--------------------------------------------------------------------
int a=1,b=2;
//--------------------------------------------------------------------
void start(){        
        int k=sum(a,b);
        Alert(k);
}
//--------------------------------------------------------------------
int sum(int& a, int& b){        
        return(a+b);
}


L'editor ha generato l'avvertimento "dichiarazione di 'a' nasconde la dichiarazione globale alla linea 4" e "dichiarazione di 'b' nasconde la dichiarazione globale alla linea 4" per questo costrutto standard, legale e popolare per gli standard del linguaggio C che è anche scorretto e analfabeta per la sua stessa essenza perché non c'è né dichiarazione di una nuova variabile all'interno di una funzione né alcun accenno a una possibile sovrapposizione di variabili.

Di conseguenza, ci sono centinaia di avvertimenti inappropriati anche in un codice di programma non troppo grande.

 
Vinin:


L'indicatore funziona, ma lo sviluppatore ha fatto un errore logico in esso


Ciao Vinin!

Hai controllato l'indicatore: AltrTrend_Signal_v2_2.mq4

e ha trovato un errore logico

in formula : SSP=MathCeil (Kperiod/iADX(NULL,0,PerADX,PRICE_CLOSE,MODE_MAIN,1))

hai sottolineato 1 alla fine

cosa pensi che dovrebbe essere?

pansa