Aiuto per la codifica - pagina 287

 
airquest:
Ciao, sto cercando di estrarre il valore più alto e più basso per x periodi della linea principale di uno stocastico in un buffer. Ho letto da qualche parte che devo fare un Array con i valori, ma non funziona. Finora sono bloccato con questo codice. Sto facendo bene, qualcuno può aiutarmi con questo? Grazie mille. Saluti.

double num_array[1]={iStochastic(NULL,0,5,3,3,MODE_SMA,0,MODE_MAIN,CustomPeriod)};

int gmax=ArrayMaximum(num_array[1],WHOLE_ARRAY,0);

int gmin=ArrayMinimum(num_array[1],WHOLE_ARRAY,0);

MinBuffer=gmin;

MaxBuffer=gmax;

Va bene, ho trovato la risposta... Bufferare l'iStocastico, impostare i valori in una serie con ArraySetAsSeries, poi fare ArrayMaximum della serie .

 
airquest:
Va bene, ho trovato la risposta... Bufferare l'iStochastic, impostare i valori in una serie con ArraySetAsSeries, poi fare ArrayMaximum della serie .

sostituire

ArrayMaximum(num_array[1],WHOLE_ARRAY,0);

ArrayMinimum(num_array[1],WHOLE_ARRAY,0);

con

ArrayMaximum(num_array,WHOLE_ARRAY,0);

ArrayMinimum(num_array,WHOLE_ARRAY,0);

 
zigflip:
scusate il mio errore, li ho mischiati mentre usavo ancora quello corretto già dojh! stupidi metaquote per cambiare ogni cosa

Non sei l'unico con questo tipo di esperienza.

Questo è tutt'altro che facile da usare

 

Ciao Coders & Crackers,

Ho bisogno della vostra competenza per modificare un indicatore ZigZag on Close (allegato).

Ho bisogno invece di uno ZigZag on Open (stesse impostazioni di base). L'avviso sull'apertura di una nuova candela sarebbe un bel tocco (se possibile).

Molto apprezzato, grazie!

File:
 
razo:
Ciao Coders & Crackers,

Ho bisogno della vostra competenza per modificare un indicatore ZigZag on Close (allegato).

Ho bisogno invece di uno ZigZag on Open (stesse impostazioni di base). L'avviso sull'apertura di una nuova candela sarebbe un bel tocco (se possibile).

Molto apprezzato, grazie!

Ciao Razo, questo è lo zigzag open.

File:
 

Ciao a tutti i guru,

Sto avendo problemi con iCustom con il seguente indicatore come allegato... barre #VQ.

Qualcuno potrebbe per favore mostrarmi come estrarre il valore del seguente buffer....DIR[]

Sto usando il seguente codice per estrarre il buffer... ma non restituisce alcun valore....

double dir=iCustom(NULL,PERIOD_M1, "#VQ bars",4,0);

Qualcuno potrebbe per favore dare un'occhiata a questo problema...

Il vostro aiuto e i vostri assistenti sono molto apprezzati.....

#property indicator_chart_window

#proprietà indicator_buffers 2

#proprietà indicator_color1 Verde

#proprietà indicator_color2 Rosso

#proprietà indicator_width1 2

#proprietà indicator_width2 2

extern int Length = 5;

extern int Method = 3;

extern int Smoothing = 1;

extern int Filter = 5;

extern bool Steady = false;

double VQ[];

double SumVQ[]

double DIR[];

double UpBuffer[]

double DnBuffer[];

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

int init()

{

IndicatorBuffer(5);

SetIndexStyle(0,DRAW_HISTOGRAM);

SetIndexBuffer(0,UpBuffer);

SetIndexStyle(1,DRAW_HISTOGRAM);

SetIndexBuffer(1,DnBuffer);

SetIndexBuffer(2,SumVQ);

SetIndexBuffer(3,VQ);

SetIndexBuffer(4,DIR);

se (Lunghezza < 2) Lunghezza = 2;

se (Metodo < 0) Metodo = 0;

se (Metodo > 3) Metodo = 3;

if (Smoothing < 0) Smoothing = 0;

if (Filter < 0) Filter = 0;

stringa short_name = "VQ | "+ Lunghezza + " , " +

Metodo + " , " + Smoothing + " , " + Filtro + " | ";

IndicatoreNomeCorto(nome_corto);

SetIndexEmptyValue(0, 0.0);

SetIndexEmptyValue(1, 0.0);

SetIndexEmptyValue(2, 0.0);

SetIndexEmptyValue(3, 0.0);

return(0);

}

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

int start()

{

double MH = 0, ML = 0, MO = 0, MC = 0, MC1 = 0;

int i, j, limite, counted_bars=IndicatorCounted();

//---- controllare eventuali errori

if(counted_bars<0) return(-1);

//---- l'ultima barra contata sarà ricontata

if(counted_bars>0) counted_bars--;

//----

if(counted_bars<1) i=Bars-Length-1;

altrimenti i=Bars-counted_bars;

if(counted_bars<1)

{

j=Lunghezza delle barre-1;

SumVQ[j + 1] = Close[j + 1];

}

mentre (i >= 0)

{

MH = iMA(NULL,0,Lunghezza,0,Metodo,PREZZO_ALTO,i);

ML = iMA(NULL,0,Lunghezza,0,Metodo,PREZZO_BASSO,i);

MO = iMA(NULL,0,Length,0,Method,PRICE_OPEN,i);

MC = iMA(NULL,0,Lunghezza,0,Metodo,PREZZO_CHIUSO,i);

MC1 = iMA(NULL,0,Lunghezza,0,Metodo,PREZZO_CHIUSO,i+Lisciatura);

se (Steady==true)

{

MC=iMA(NULL,0,Lunghezza,0,Metodo,PREZZO_MEDIANO,i);

MC1=iMA(NULL,0,Lunghezza,0,Metodo,PREZZO_MEDIANO,i+Lisciatura);

}

if((MH - ML)>0)

VQ = MathAbs(((MC - MC1) / MathMax(MH - ML, MathMax(MH - MC1, MC1 - ML)) + (MC - MO) / (MH - ML)) * 0,5) * ((MC - MC1 + (MC - MO)) * 0.5);

SumVQ = SumVQ + VQ;

se (Filtro > 0)

se (MathAbs(SumVQ - SumVQ) < Filter * Point)

SumVQ = SumVQ;

i--;

}

se (counted_bars<1)

limit=Bars-lunghezza-1;

altrimenti limit=Bars-counted_bars;

for (i = limite-1; i >= 0; i--)

{

se (SumVQ > SumVQ) DIR = 1;

se (SumVQ < SumVQ) DIR = -1;

se (SumVQ== SumVQ) DIR = DIR;

se (DIR > 0)

{

UpBuffer = Alto;

DnBuffer = Basso;

}

altrimenti

se (DIR < 0)

{

DnBuffer = Alto;

UpBuffer = Basso;

}

}

return(0);

}

 
12BPRO:
Ciao a tutti i guru,

Sto avendo problemi con iCustom con il seguente indicatore come allegato... barre #VQ.

Qualcuno potrebbe per favore mostrarmi come estrarre il valore del seguente buffer....DIR[]

Sto usando il seguente codice per estrarre il buffer... ma non restituisce alcun valore....

double dir=iCustom(NULL,PERIOD_M1, "#VQ bars",4,0);

Qualcuno potrebbe dare un'occhiata a questo problema...

Il vostro aiuto e gli assistenti sono molto apprezzati.....

Tutto sembra essere OK

Allego le barre #vq e un indicatore di prova che utilizza questi valori e mostra i valori corretti

vq_bars.mq4

test_vq.mq4

File:
vq_bars.mq4  3 kb
_test_vq.mq4  1 kb
 
mladen:
Tutto sembra essere OK Allegando le barre #vq così come un indicatore di test che usa quei valori e mostra i valori corretti

vq_bars.mq4

prova_vq.mq4

Wow... Grazie signore MLADEN....

La cosa più strana è successa... quel codice non funziona sul mio indicatore... non può aprire il log degli errori....

ma l'ho testato sulle barre #VQ e funziona benissimo....

Ho sprecato qualche ora su questo....

Cosa posso dire.... Sono in debito con te....SIR.... per avermi chiarito questa cosa.....

Questo è il mio #VQ.....

Ha il valore ma quando chiamo l'iCustom nell'EA non ha alcun valore.... cosa posso dire.... sciocco me....

File:
gbpjpy_test.jpg  123 kb
my_vq.jpg  48 kb
 

Caro signor MLADEN,

Potrebbe per favore dare un'occhiata al mio indicatore #VQ....... Ho eliminato alcune linee che non uso.... e aggiunto alcuni avvisi....

Forse è questa la causa del problema per non essere in grado di chiamare il buffer nell'EA tramite iCustom....

Il vostro aiuto è ancora una volta molto apprezzato.....

Sinceramente vostro

AZRUL.......

#proprietà indicator_chart_window

#proprietà indicator_buffers 2

#proprietà indicatore_colore1 Verde

#proprietà indicatore_colore2 Rosso

#proprietà indicator_width1 2

#proprietà indicator_width2 2

extern int Length = 5;

extern int Method = 3;

extern int Smoothing = 1;

extern double Filter = 0.5;

extern bool Steady = False;

extern string SoundGbp = "news.wav

extern string SoundEur = "news.wav";

extern bool PopupAlert = true;

extern bool SendPushNotification = false;

extern bool SoundAlert = True;

int lastAlert=3;

double VQ[];

double SumVQ[]

double DIR[];

double UpBuffer[]

double DnBuffer[];

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

int init()

{

IndicatorBuffer(5);

SetIndexStyle(0,DRAW_HISTOGRAM);

SetIndexBuffer(0,UpBuffer);

SetIndexStyle(1,DRAW_HISTOGRAM);

SetIndexBuffer(1,DnBuffer);

SetIndexBuffer(2,SumVQ);

SetIndexBuffer(3,VQ);

SetIndexBuffer(4,DIR);

se (Lunghezza < 2) Lunghezza = 2;

se (Metodo < 0) Metodo = 0;

se (Metodo > 3) Metodo = 3;

if (Smoothing < 0) Smoothing = 0;

if (Filter < 0) Filter = 0;

stringa short_name = "VQ | "+ Lunghezza + " , " +

Metodo + " , " + Smoothing + " , " + Filtro + " | ";

IndicatoreNomeCorto(nome_corto);

SetIndexEmptyValue(0, 0.0);

SetIndexEmptyValue(1, 0.0);

SetIndexEmptyValue(2, 0.0);

SetIndexEmptyValue(3, 0.0);

return(0);

}

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

int start()

{

int i, limit, counted_bars=IndicatorCounted();

//---- controllare eventuali errori

if(counted_bars<0) return(-1);

//---- l'ultima barra contata sarà ricontata

if(counted_bars>0) counted_bars--;

//----

if(counted_bars<1) i=Lunghezza barre;

altrimenti i=Bars-counted_bars;

se(barre contate<1)

mentre (i >= 0)

{

VQ = iCustom(NULL,0, "#pollan indy",0,i+1);

SumVQ= iCustom(NULL,0, "#pollan indy",1,i+1);

//if (Filtro > 0)

//if (MathAbs(VQ - SumVQ) < Filter)

//VQ = SumVQ;

i--;

}

if(counted_bars<1)

limit=Bars-lunghezza-1;

altrimenti limit=Bars-counted_bars;

for (i = limite-1; i >= 0; i--)

{

//se (VQ > SumVQ) DIR = 1;

se ((VQ+VQ) > (SumVQ+SumVQ))

DIR = 1;

se ((VQ+VQ) < (SumVQ+SumVQ))

DIR = -1;

se ((VQ+VQ) == (SumVQ+SumVQ))

DIR = DIR;

se (DIR > 0)

{

UpBuffer = Alto;

DnBuffer = Basso;

}

altrimenti

se (DIR < 0)

{

DnBuffer = Alto;

UpBuffer = Basso;

}

se ((DIR > 0) && (DIR > 0))

{

CheckForAlerts(OP_BUY);//ALERT BUY

}

if ((DIR < 0) && (DIR < 0))

{

CheckForAlerts(OP_SELL);//ALLERTA VENDITA

}

}

double vq1=iCustom(NULL,0, "#pollan indy",0,i+1);

double svq1=iCustom(NULL,0, "#pollan indy",1,i+1);

double vq2=iCustom(NULL,0, "#pollan indy",0,i+2);

double svq2=iCustom(NULL,0, "#pollan indy",1,i+2);

double vq3=iCustom(NULL,0, "#pollan indy",0,i+3);

double svq3=iCustom(NULL,0, "#pollan indy",1,i+3);

double dir1=DIR;

double dir2=DIR;

doppio dir3=DIR;

double vq0= (vq1 + vq2);

doppio svq0= (svq1 + svq2);

stringa VQ0_Teks=DoubleToStr(vq0,6);

stringa VQS0_Teks=DoubleToStr(svq0,6);

stringa VQ1_Teks=DoubleToStr(vq1,6);

stringa VQS1_Teks=DoubleToStr(svq1,6);

stringa VQ2_Teks=DoubleToStr(vq2,6);

stringa VQS2_Teks=DoubleToStr(svq2,6);

stringa VQ3_Teks=DoubleToStr(vq3,6);

string VQS3_Teks=DoubleToStr(svq3,6);

string dir1_Teks=DoubleToStr(dir1,6);

string dir2_Teks=DoubleToStr(dir2,6);

string dir3_Teks=DoubleToStr(dir3,6);

stringa h =

" Blu" + " " + VQ0_Teks+ " " + " Rosso" + " " + VQS0_Teks + "\n" +

" Blu" + " " + VQ1_Teks+ " " + " Rosso" + " " + VQS1_Teks + "\n" +

" Blu" + " " + VQ2_Teks+ " " + " Rosso" + " " + VQS2_Teks + "\n" +

" Blu" + " " + VQ3_Teks+ " " + " Rosso" + " " + VQS3_Teks + "\n" + "\n" +

" DIR1" + " " + dir1_Teks+" " + "DIR2" + " " + dir2_Teks + " " + "DIR3" + " + dir3_Teks;

Commento(h);

return(0);

}

//--------------------------------------------------------------

void CheckForAlerts(int type)

{

//ALERTI:

static datetime lastAlertTime=0;

if (lastAlertTime != iTime(NULL,0,0)) {

if (type==OP_BUY && lastAlert!=2) { //BUY

doAlerts("Pollan BAR UP "+Symbol()+" (tf: "+Period()+")",SoundEur);

lastAlert=2;

lastAlertTime=iTime(NULL,0,0);

}

if (type==OP_SELL && lastAlert!=1) { //SELL

doAlerts("Pollan BAR DOWN "+Symbol()+" (tf: "+Period()+")",SoundGbp);

lastAlert=1;

lastAlertTime=iTime(NULL,0,0);

}

}//if (lastAlertTime != iTime(NULL,0,0) {

//end ALERTS

}

//--------------------------------------------------------------

void doAlerts(string sMsg,string SoundFile) {

se (PopupAlert) Alert(sMsg);

if(SoundAlert) PlaySound(SoundFile);

if(SendPushNotification) SendNotification(sMsg);

}

GRAZIE........

 
12BPRO:
Caro signor MLADEN,

Potresti per favore dare un'occhiata al mio indicatore #VQ....... Ho eliminato alcune linee che non uso.... e aggiunto alcuni avvisi....

Forse è questa la causa del problema per non essere in grado di chiamare il buffer nell'EA tramite iCustom....

Il vostro aiuto è ancora una volta molto apprezzato.....

Sinceramente vostro

AZRUL.......

#proprietà indicator_chart_window

#proprietà indicator_buffers 2

#proprietà indicatore_colore1 Verde

#proprietà indicatore_colore2 Rosso

#proprietà indicator_width1 2

#proprietà indicator_width2 2

extern int Length = 5;

extern int Method = 3;

extern int Smoothing = 1;

extern double Filter = 0.5;

extern bool Steady = False;

extern string SoundGbp = "news.wav

extern string SoundEur = "news.wav";

extern bool PopupAlert = true;

extern bool SendPushNotification = false;

extern bool SoundAlert = True;

int lastAlert=3;

double VQ[];

double SumVQ[]

double DIR[];

double UpBuffer[]

double DnBuffer[];

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

int init()

{

IndicatorBuffer(5);

SetIndexStyle(0,DRAW_HISTOGRAM);

SetIndexBuffer(0,UpBuffer);

SetIndexStyle(1,DRAW_HISTOGRAM);

SetIndexBuffer(1,DnBuffer);

SetIndexBuffer(2,SumVQ);

SetIndexBuffer(3,VQ);

SetIndexBuffer(4,DIR);

se (Lunghezza < 2) Lunghezza = 2;

se (Metodo < 0) Metodo = 0;

se (Metodo > 3) Metodo = 3;

if (Smoothing < 0) Smoothing = 0;

if (Filter < 0) Filter = 0;

stringa short_name = "VQ | "+ Lunghezza + " , " +

Metodo + " , " + Smoothing + " , " + Filtro + " | ";

IndicatoreNomeCorto(nome_corto);

SetIndexEmptyValue(0, 0.0);

SetIndexEmptyValue(1, 0.0);

SetIndexEmptyValue(2, 0.0);

SetIndexEmptyValue(3, 0.0);

return(0);

}

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

int start()

{

int i, limit, counted_bars=IndicatorCounted();

//---- controllare eventuali errori

if(counted_bars<0) return(-1);

//---- l'ultima barra contata sarà ricontata

if(counted_bars>0) counted_bars--;

//----

if(counted_bars<1) i=Lunghezza barre;

altrimenti i=Bars-counted_bars;

se(barre contate<1)

mentre (i >= 0)

{

VQ = iCustom(NULL,0, "#pollan indy",0,i+1);

SumVQ= iCustom(NULL,0, "#pollan indy",1,i+1);

//if (Filtro > 0)

//if (MathAbs(VQ - SumVQ) < Filter)

//VQ = SumVQ;

i--;

}

if(counted_bars<1)

limit=Bars-lunghezza-1;

altrimenti limit=Bars-counted_bars;

for (i = limite-1; i >= 0; i--)

{

//se (VQ > SumVQ) DIR = 1;

se ((VQ+VQ) > (SumVQ+SumVQ))

DIR = 1;

se ((VQ+VQ) < (SumVQ+SumVQ))

DIR = -1;

se ((VQ+VQ) == (SumVQ+SumVQ))

DIR = DIR;

se (DIR > 0)

{

UpBuffer = Alto;

DnBuffer = Basso;

}

altrimenti

se (DIR < 0)

{

DnBuffer = Alto;

UpBuffer = Basso;

}

se ((DIR > 0) && (DIR > 0))

{

CheckForAlerts(OP_BUY);//ALERT BUY

}

if ((DIR < 0) && (DIR < 0))

{

CheckForAlerts(OP_SELL);//ALLERTA VENDITA

}

}

double vq1=iCustom(NULL,0, "#pollan indy",0,i+1);

double svq1=iCustom(NULL,0, "#pollan indy",1,i+1);

double vq2=iCustom(NULL,0, "#pollan indy",0,i+2);

double svq2=iCustom(NULL,0, "#pollan indy",1,i+2);

double vq3=iCustom(NULL,0, "#pollan indy",0,i+3);

double svq3=iCustom(NULL,0, "#pollan indy",1,i+3);

double dir1=DIR;

double dir2=DIR;

doppio dir3=DIR;

double vq0= (vq1 + vq2);

doppio svq0= (svq1 + svq2);

stringa VQ0_Teks=DoubleToStr(vq0,6);

stringa VQS0_Teks=DoubleToStr(svq0,6);

stringa VQ1_Teks=DoubleToStr(vq1,6);

stringa VQS1_Teks=DoubleToStr(svq1,6);

stringa VQ2_Teks=DoubleToStr(vq2,6);

stringa VQS2_Teks=DoubleToStr(svq2,6);

stringa VQ3_Teks=DoubleToStr(vq3,6);

string VQS3_Teks=DoubleToStr(svq3,6);

string dir1_Teks=DoubleToStr(dir1,6);

string dir2_Teks=DoubleToStr(dir2,6);

string dir3_Teks=DoubleToStr(dir3,6);

stringa h =

" Blu" + " " + VQ0_Teks+ " " + " Rosso" + " " + VQS0_Teks + "\n" +

" Blu" + " " + VQ1_Teks+ " " + " Rosso" + " " + VQS1_Teks + "\n" +

" Blu" + " " + VQ2_Teks+ " " + " Rosso" + " " + VQS2_Teks + "\n" +

" Blu" + " " + VQ3_Teks+ " " + " Rosso" + " " + VQS3_Teks + "\n" + "\n" +

" DIR1" + " " + dir1_Teks+" " + "DIR2" + " " + dir2_Teks + " " + "DIR3" + " + dir3_Teks;

Commento(h);

return(0);

}

//--------------------------------------------------------------

void CheckForAlerts(int type)

{

//ALERTI:

static datetime lastAlertTime=0;

if (lastAlertTime != iTime(NULL,0,0)) {

if (type==OP_BUY && lastAlert!=2) { //BUY

doAlerts("Pollan BAR UP "+Symbol()+" (tf: "+Period()+")",SoundEur);

lastAlert=2;

lastAlertTime=iTime(NULL,0,0);

}

if (type==OP_SELL && lastAlert!=1) { //SELL

doAlerts("Pollan BAR DOWN "+Symbol()+" (tf: "+Period()+")",SoundGbp);

lastAlert=1;

lastAlertTime=iTime(NULL,0,0);

}

}//if (lastAlertTime != iTime(NULL,0,0) {

//end ALERTS

}

//--------------------------------------------------------------

void doAlerts(string sMsg,string SoundFile) {

se (PopupAlert) Alert(sMsg);

if(SoundAlert) PlaySound(SoundFile);

if(SendPushNotification) SendNotification(sMsg);

}

GRAZIE........

L'hai cambiato per usare "#pollan indy"

Non ho idea di cosa faccia quell'indicatore (se è come il resto degli indicatori "pollan" allora ridisegna e questo può causare i tuoi problemi, ma ora sto solo facendo il gioco delle ipotesi)