Aide au codage - page 287

 
airquest:
Bonjour, J'essaie d'extraire la valeur la plus haute et la plus basse pour x périodes de la ligne principale d'une stochastique dans un tampon. J'ai lu quelque part que je devais créer un tableau avec les valeurs, mais cela ne fonctionne pas. Jusqu'à présent, je suis coincé avec ce code. Est-ce que je fais bien, quelqu'un peut-il m'aider ? Merci beaucoup. Salutations.

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;

C'est bon, j'ai trouvé la réponse... Mettre en mémoire tampon l'iStochastic, mettre les valeurs dans une série avec ArraySetAsSeries, puis faire ArrayMaximum de la série .

 
airquest:
C'est bon, j'ai trouvé la réponse... Mettre en mémoire tampon l'iStochastic, mettre les valeurs dans une série avec ArraySetAsSeries, puis faire ArrayMaximum de la série .

remplacer

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

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

avec

ArrayMaximum(num_array,WHOLE_ARRAY,0) ;

ArrayMinimum(num_array,WHOLE_ARRAY,0) ;

 
zigflip:
désolé, c'est ma faute, je les ai mélangés alors que j'utilisais déjà le bon ! stupide metaquotes pour tout changer

Vous n'êtes pas le seul à avoir ce genre d'expérience.

C'est tout sauf convivial

 

Bonjour Coders & Crackers,

J'ai besoin de votre expertise pour modifier un indicateur ZigZag on Close (ci-joint).

J'ai besoin d'un ZigZag sur l'ouverture à la place (mêmes paramètres de base). Une alerte sur l'ouverture d'une nouvelle bougie serait un plus (si possible).

Merci beaucoup, merci !

Dossiers :
 
razo:
Bonjour Coders & Crackers,

J'ai besoin de votre expertise pour modifier un indicateur ZigZag on Close (ci-joint).

J'ai besoin d'un ZigZag sur l'ouverture à la place (mêmes paramètres de base). Une alerte sur l'ouverture de la nouvelle bougie serait une bonne chose (si possible).

Très apprécié, merci !

Bonjour Razo, c'est le zigzag d'ouverture.

Dossiers :
 

Bonjour à tous les gourous,

J'ai un problème avec iCustom avec l'indicateur suivant tel que joint... #Barres VQ.

Quelqu'un pourrait-il me montrer comment extraire la valeur du tampon suivant....DIR[] ?

J'utilise le code suivant pour extraire le tampon... mais il ne retourne aucune valeur....

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

Quelqu'un pourrait-il se pencher sur cette question ?

Votre aide et vos assistants sont très appréciés.....

#property indicator_chart_window

#property indicator_buffers 2

#property indicator_color1 Vert

#property indicator_color2 Rouge

#property indicator_width1 2

#property 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()

{

IndicatorBuffers(5) ;

SetIndexStyle(0,DRAW_HISTOGRAM) ;

SetIndexBuffer(0,UpBuffer) ;

SetIndexStyle(1,DRAW_HISTOGRAM) ;

SetIndexBuffer(1,DnBuffer) ;

SetIndexBuffer(2,SumVQ) ;

SetIndexBuffer(3,VQ) ;

SetIndexBuffer(4,DIR) ;

if (Length < 2) Length = 2 ;

si (Méthode < 0) Méthode = 0 ;

si (Méthode > 3) Méthode = 3 ;

if (Smoothing < 0) Smoothing = 0 ;

if (Filter < 0) Filter = 0 ;

string short_name = "VQ | "+ Length + " , " +

Method + " , " + Smoothing + " , " + Filter + " | " ;

IndicatorShortName(short_name) ;

SetIndexEmptyValue(0, 0.0) ;

SetIndexEmptyValue(1, 0.0) ;

SetIndexEmptyValue(2, 0.0) ;

SetIndexEmptyValue(3, 0.0) ;

retour(0) ;

}

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

int start()

{

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

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

//---- vérifier les erreurs éventuelles

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

//---- dernière barre comptée sera recomptée

if(counted_bars>0) counted_bars-- ;

//----

if(counted_bars<1) i=Longueur_barres-1 ;

sinon i=Bars-compte_barres ;

si(barres_comptées<1)

{

j=Longueur des barres-1 ;

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

}

while (i >= 0)

{

MH = iMA(NULL,0,Length,0,Method,PRICE_HIGH,i) ;

ML = iMA(NULL,0,Length,0,Method,PRICE_LOW,i) ;

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

MC = iMA(NULL,0,Length,0,Method,PRICE_CLOSE,i) ;

MC1 = iMA(NULL,0,Length,0,Method,PRICE_CLOSE,i+Lissage) ;

si (Steady==vrai)

{

MC=iMA(NULL,0,Length,0,Method,PRICE_MEDIAN,i) ;

MC1=iMA(NULL,0,Length,0,Method,PRICE_MEDIAN,i+Lissage) ;

}

si((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 ;

si (Filtre > 0)

si (MathAbs(SommeVQ - SommeVQ) < Filtre * Point)

SumVQ = SumVQ ;

i-- ;

}

if(counted_bars<1)

limit=Longueur_barres-1 ;

sinon limite=Barres_comptées ;

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

{

si (SumVQ > SumVQ) DIR = 1 ;

si (SumVQ < SumVQ) DIR = -1 ;

si (SumVQ== SumVQ) DIR = DIR ;

si (DIR > 0)

{

UpBuffer = High ;

DnBuffer = Low ;

}

sinon

if (DIR < 0)

{

DnBuffer = High ;

UpBuffer = Low ;

}

}

return(0) ;

}

 
12BPRO:
Bonjour à tous les gourous,

J'ai un problème avec iCustom avec l'indicateur suivant tel que joint... #Barres VQ.

Quelqu'un pourrait-il me montrer comment extraire la valeur du tampon suivant....DIR[] ?

J'utilise le code suivant pour extraire le tampon... mais il ne retourne aucune valeur....

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

Quelqu'un pourrait-il jeter un coup d'oeil à ce problème...

Votre aide et vos assistants sont très appréciés.....

Tout semble être correct

Je joins les barres #vq ainsi qu'un indicateur de test qui utilise ces valeurs et qui affiche des valeurs correctes.

vq_bars.mq4

_test_vq.mq4

Dossiers :
vq_bars.mq4  3 kb
_test_vq.mq4  1 kb
 
mladen:
Tout semble être correct J'ai joint les barres #vq ainsi qu'un indicateur de test qui utilise ces valeurs et qui affiche des valeurs correctes.

vq_bars.mq4

_test_vq.mq4

Wow... Merci Monsieur MLADEN....

La chose la plus étrange est arrivée... ce code ne fonctionne pas sur mon indicateur... impossible d'ouvrir le journal des erreurs....

mais je l'ai testé sur les barres #VQ et il fonctionne très bien....

J'ai perdu quelques heures avec ça....

Qu'est-ce que je peux dire.... Je vous dois une fière chandelle pour m'avoir éclairé sur ce sujet. .....

Voici mon #VQ.....

Il a la valeur mais lorsque j'appelle l'iCustom dans l'EA, il n'a pas de valeur.... que puis-je dire.... silly me....

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

Cher Monsieur MLADEN,

Pourriez-vous, s'il vous plaît, vous pencher sur mon indicateur #VQ....... J'ai supprimé quelques lignes que je n'utilise pas.... et ajouté quelques alertes.....

Il se peut que ce soit la cause du problème pour ne pas être capable d'appeler le tampon dans l'EA via iCustom.....

Votre AIDE, une fois de plus, est très appréciée.....

Cordialement

AZRUL.......

#property indicator_chart_window

#property indicator_buffers 2

#property indicator_color1 Green

#property indicator_color2 Red

#property indicator_width1 2

#property 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()

{

IndicatorBuffers(5) ;

SetIndexStyle(0,DRAW_HISTOGRAM) ;

SetIndexBuffer(0,UpBuffer) ;

SetIndexStyle(1,DRAW_HISTOGRAM) ;

SetIndexBuffer(1,DnBuffer) ;

SetIndexBuffer(2,SumVQ) ;

SetIndexBuffer(3,VQ) ;

SetIndexBuffer(4,DIR) ;

if (Length < 2) Length = 2 ;

si (Méthode < 0) Méthode = 0 ;

si (Méthode > 3) Méthode = 3 ;

if (Smoothing < 0) Smoothing = 0 ;

if (Filter < 0) Filter = 0 ;

string short_name = "VQ | "+ Length + " , " +

Method + " , " + Smoothing + " , " + Filter + " | " ;

IndicatorShortName(short_name) ;

SetIndexEmptyValue(0, 0.0) ;

SetIndexEmptyValue(1, 0.0) ;

SetIndexEmptyValue(2, 0.0) ;

SetIndexEmptyValue(3, 0.0) ;

retour(0) ;

}

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

int start()

{

int i, limit, counted_bars=IndicatorCounted() ;

//---- vérifier les erreurs éventuelles

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

//---- dernière barre comptée sera recomptée

if(counted_bars>0) counted_bars-- ;

//----

if(counted_bars<1) i=Longueur des barres ;

sinon i=Bars-compte_barres ;

si(barres_comptées<1)

alors que (i >= 0)

{

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

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

//si (Filtre > 0)

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

//VQ = SumVQ ;

i-- ;

}

if(counted_bars<1)

limit=Longueur_barres-1 ;

sinon, limite=Bars-comptées_barres ;

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

{

//si (VQ > SommeVQ) DIR = 1 ;

si ((VQ+VQ) > (SommeVQ+SommeVQ))

DIR = 1 ;

si ((VQ+VQ) < (SommeVQ+SommeVQ))

DIR = -1 ;

si ((VQ+VQ) == (SommeVQ+SommeVQ))

DIR = DIR ;

si (DIR > 0)

{

UpBuffer = High ;

DnBuffer = Low ;

}

sinon

if (DIR < 0)

{

DnBuffer = High ;

UpBuffer = Low ;

}

if ((DIR > 0) && (DIR > 0))

{

CheckForAlerts(OP_BUY);//ALERT BUY

}

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

{

CheckForAlerts(OP_SELL);//ALERTE VENTE

}

}

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 ;

double dir3=DIR ;

double vq0= (vq1 + vq2) ;

double svq0= (svq1 + svq2) ;

string VQ0_Teks=DoubleToStr(vq0,6) ;

string VQS0_Teks=DoubleToStr(svq0,6) ;

string VQ1_Teks=DoubleToStr(vq1,6) ;

string VQS1_Teks=DoubleToStr(svq1,6) ;

string VQ2_Teks=DoubleToStr(vq2,6) ;

string VQS2_Teks=DoubleToStr(svq2,6) ;

string 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) ;

chaîne h =

" Bleu" + " " + VQ0_Teks+ " " + " Rouge" + " " + VQS0_Teks + "\n" +

" Bleu" + " " + VQ1_Teks+ " " + " Rouge" + " " + VQS1_Teks + "\n" +

" Bleu" + " " + VQ2_Teks+ " " + " Rouge" + " " + VQS2_Teks + "\n" +

" Bleu" + " " + VQ3_Teks+ " " + " Rouge" + " " + VQS3_Teks + "\n" + "\n" +

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

Commentaire(h) ;

retour(0) ;

}

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

void CheckForAlerts(int type)

{

//ALERTS :

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) {

//fin des ALERTS

}

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

void doAlerts(string sMsg,string SoundFile) {

if (PopupAlert) Alert(sMsg) ;

if(SoundAlert) PlaySound(SoundFile) ;

if(SendPushNotification) SendNotification(sMsg) ;

}

MERCI........

 
12BPRO:
Cher Monsieur MLADEN,

Pourriez-vous, s'il vous plaît, examiner mon indicateur #VQ....... J'ai supprimé quelques lignes que je n'utilise pas.... et ajouté quelques alertes.....

Il se peut que ce soit la cause du problème pour ne pas être capable d'appeler le tampon dans l'EA via iCustom.....

Votre AIDE, une fois de plus, est très appréciée.....

Cordialement

AZRUL.......

#property indicator_chart_window

#property indicator_buffers 2

#property indicator_color1 Green

#property indicator_color2 Red

#property indicator_width1 2

#property 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()

{

IndicatorBuffers(5) ;

SetIndexStyle(0,DRAW_HISTOGRAM) ;

SetIndexBuffer(0,UpBuffer) ;

SetIndexStyle(1,DRAW_HISTOGRAM) ;

SetIndexBuffer(1,DnBuffer) ;

SetIndexBuffer(2,SumVQ) ;

SetIndexBuffer(3,VQ) ;

SetIndexBuffer(4,DIR) ;

if (Length < 2) Length = 2 ;

si (Méthode < 0) Méthode = 0 ;

si (Méthode > 3) Méthode = 3 ;

if (Smoothing < 0) Smoothing = 0 ;

if (Filter < 0) Filter = 0 ;

string short_name = "VQ | "+ Length + " , " +

Method + " , " + Smoothing + " , " + Filter + " | " ;

IndicatorShortName(short_name) ;

SetIndexEmptyValue(0, 0.0) ;

SetIndexEmptyValue(1, 0.0) ;

SetIndexEmptyValue(2, 0.0) ;

SetIndexEmptyValue(3, 0.0) ;

retour(0) ;

}

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

int start()

{

int i, limit, counted_bars=IndicatorCounted() ;

//---- vérifier les erreurs éventuelles

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

//---- dernière barre comptée sera recomptée

if(counted_bars>0) counted_bars-- ;

//----

if(counted_bars<1) i=Longueur des barres ;

sinon i=Bars-compte_barres ;

si(barres_comptées<1)

alors que (i >= 0)

{

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

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

//si (Filtre > 0)

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

//VQ = SumVQ ;

i-- ;

}

if(counted_bars<1)

limit=Longueur_barres-1 ;

sinon, limite=Bars-comptées_barres ;

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

{

//si (VQ > SommeVQ) DIR = 1 ;

si ((VQ+VQ) > (SommeVQ+SommeVQ))

DIR = 1 ;

si ((VQ+VQ) < (SommeVQ+SommeVQ))

DIR = -1 ;

si ((VQ+VQ) == (SommeVQ+SommeVQ))

DIR = DIR ;

si (DIR > 0)

{

UpBuffer = High ;

DnBuffer = Low ;

}

sinon

if (DIR < 0)

{

DnBuffer = High ;

UpBuffer = Low ;

}

if ((DIR > 0) && (DIR > 0))

{

CheckForAlerts(OP_BUY);//ALERT BUY

}

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

{

CheckForAlerts(OP_SELL);//ALERTE VENTE

}

}

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 ;

double dir3=DIR ;

double vq0= (vq1 + vq2) ;

double svq0= (svq1 + svq2) ;

string VQ0_Teks=DoubleToStr(vq0,6) ;

string VQS0_Teks=DoubleToStr(svq0,6) ;

string VQ1_Teks=DoubleToStr(vq1,6) ;

string VQS1_Teks=DoubleToStr(svq1,6) ;

string VQ2_Teks=DoubleToStr(vq2,6) ;

string VQS2_Teks=DoubleToStr(svq2,6) ;

string 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) ;

chaîne h =

" Bleu" + " " + VQ0_Teks+ " " + " Rouge" + " " + VQS0_Teks + "\n" +

" Bleu" + " " + VQ1_Teks+ " " + " Rouge" + " " + VQS1_Teks + "\n" +

" Bleu" + " " + VQ2_Teks+ " " + " Rouge" + " " + VQS2_Teks + "\n" +

" Bleu" + " " + VQ3_Teks+ " " + " Rouge" + " " + VQS3_Teks + "\n" + "\n" +

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

Commentaire(h) ;

retour(0) ;

}

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

void CheckForAlerts(int type)

{

//ALERTS :

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) {

//fin des ALERTS

}

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

void doAlerts(string sMsg,string SoundFile) {

if (PopupAlert) Alert(sMsg) ;

if(SoundAlert) PlaySound(SoundFile) ;

if(SendPushNotification) SendNotification(sMsg) ;

}

THANKS........

Vous l'avez modifié pour utiliser "#pollan indy".

Je n'ai aucune idée de ce que fait cet indicateur (s'il est comme le reste des indicateurs "pollan", il repeint et cela peut causer vos problèmes, mais je ne fais que deviner maintenant).

Raison: