Aide au codage - page 489

 

Je vois maintenant que je dois supprimer la ligne else AlarmTotal = AlarmTotal+1 ;

 

Besoin d'aide pour ajouter du texte à mon indicateur

J'ai écrit un indicateur personnalisé qui trouve les hauts et les bas de l'oscillation.

Actuellement, il place un objet flèche qui pointe vers le niveau de prix et la barre de temps. Vert pour le haut et rouge pour le bas.

Je voudrais le changer en texte qui montre une variable de comptage.

Voici une partie du code que j'ai créé mais il n'affiche pas le texte.

Quelqu'un peut-il me montrer ce qui ne va pas ? Merci.

if (Low < Low

&& Low < Low

&& Low < Low

&& Low < Low

&& Low < Low

&& Low < Low)

{

SwingLoBar = 1;

SwingLo = Low;

SwingCount = SwingCount + 1;

ObjectCreate("Text",OBJ_TEXT,0,0,0);

ObjectSet("Text",OBJPROP_TIME,i);

ObjectSet("Text",OBJPROP_PRICE,SwingLo-20*pips);

ObjectSetString(0,"Text",OBJPROP_TEXT,SwingCount);

ObjectSet("Text",OBJPROP_COLOR,clrRed);
 
ThemBonez:
J'ai écrit un indicateur personnalisé qui trouve les hauts et les bas de l'oscillation.

Actuellement, il met une flèche objet pointant vers le niveau de prix et la barre de temps. Vert pour le haut et rouge pour le bas.

Je voudrais le changer en texte qui montre une variable de comptage.

Voici une partie du code que j'ai créé mais il n'affiche pas le texte.

Quelqu'un peut-il me montrer ce qui ne va pas ? Merci.

if (Low < Low

&& Low < Low

&& Low < Low

&& Low < Low

&& Low < Low

&& Low < Low)

{

SwingLoBar = 1;

SwingLo = Low;

SwingCount = SwingCount + 1;

ObjectCreate("Text",OBJ_TEXT,0,0,0);

ObjectSet("Text",OBJPROP_TIME,i);

ObjectSet("Text",OBJPROP_PRICE,SwingLo-20*pips);

ObjectSetString(0,"Text",OBJPROP_TEXT,SwingCount);

ObjectSet("Text",OBJPROP_COLOR,clrRed);

Essayez de changer

ObjectSet("Text",OBJPROP_TIME,i) ;

ObjectSet("Text",OBJPROP_PRICE,SwingLo-20*pips) ;

à

ObjectSet("Text",OBJPROP_TIME1,Time) ;

ObjectSet("Text",OBJPROP_PRICE1,SwingLo-20*_Point) ;

 

Merci, mais ça n'a pas aidé. Pas d'étiquettes de texte.

Voici le code complet, peut-être que cela vous aidera.

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

//| SwingHighLow.mq4 |

//| Dream Reality Productions, LLC |

//| http://www.dreamrealityproductions.com |

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

#property copyright "Dream Reality Productions, LLC"

#property link "http://www.dreamrealityproductions.com"

#property indicator_chart_window

#property indicator_buffers 6

#property indicator_color1 Orange

#property indicator_color2 Aqua

double SwingHiBar[];

double SwingLoBar[];

double SwingHiDraw[];

double SwingLoDraw[];

double SwingHi[];

double SwingLo[];

static int SwingCount=0;

double pips;

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

//| Custom indicator initialization function |

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

int init()

{

SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID,1);

SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,1);

SetIndexArrow(1,233);

SetIndexArrow(0,234);

SetIndexBuffer(0,SwingHiDraw);

SetIndexBuffer(1,SwingLoDraw);

SetIndexBuffer(2,SwingHiBar);

SetIndexBuffer(3,SwingLoBar);

SetIndexBuffer(4,SwingHi);

SetIndexBuffer(5,SwingLo);

double ticksize = MarketInfo (Symbol(),MODE_TICKSIZE);

if (ticksize == .00001 || ticksize == .001)

pips = ticksize * 10;

else pips = ticksize;

return(0);

}

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

//| Custom indicator iteration function |

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

int start()

{

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

//| Find Hi and Lo Bars |

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

int counted_bars = IndicatorCounted();

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

if (counted_bars>0) counted_bars--;

int uncountedbars = Bars - counted_bars;

//---

for (int i=4;i<uncountedbars;i++)

{

if (High > High

&& High > High

&& High > High

&& High > High

&& High > High

&& High > High)

{

SwingHiBar = 1;

SwingHi = High;

SwingCount = SwingCount + 1;

ObjectCreate("Text",OBJ_TEXT,0,0,0);

ObjectSet("Text",OBJPROP_TIME1,Time);

ObjectSet("Text",OBJPROP_PRICE1,SwingHi+20*pips);

ObjectSetString(0,"Text",OBJPROP_TEXT,SwingCount);

ObjectSet("Text",OBJPROP_COLOR,clrGreen);

}

else

{ SwingHiBar=0; SwingHi=0;

SwingHiDraw=0;

if (Low < Low

&& Low < Low

&& Low < Low

&& Low < Low

&& Low < Low

&& Low < Low)

{

SwingLoBar = 1;

SwingLo = Low;

SwingCount = SwingCount + 1;

ObjectCreate("Text",OBJ_TEXT,0,0,0);

ObjectSet("Text",OBJPROP_TIME1,Time);

ObjectSet("Text",OBJPROP_PRICE1,SwingLo-20*_Point);

ObjectSetString(0,"Text",OBJPROP_TEXT,SwingCount);

ObjectSet("Text",OBJPROP_COLOR,clrRed);

}

else {SwingLoBar = 0; SwingLo=0;

SwingLoDraw=0;}

}

}

return(0);

}

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

 
ThemBonez:
Merci, mais ça n'a pas aidé. Pas d'étiquettes de texte.

Voici l'intégralité du code, cela pourrait peut-être vous aider.

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

//| SwingHighLow.mq4 |

//| Dream Reality Productions, LLC |

//| http://www.dreamrealityproductions.com |

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

#property copyright "Dream Reality Productions, LLC"

#property link "http://www.dreamrealityproductions.com"

#property indicator_chart_window

#property indicator_buffers 6

#property indicator_color1 Orange

#property indicator_color2 Aqua

double SwingHiBar[];

double SwingLoBar[];

double SwingHiDraw[];

double SwingLoDraw[];

double SwingHi[];

double SwingLo[];

static int SwingCount=0;

double pips;

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

//| Custom indicator initialization function |

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

int init()

{

SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID,1);

SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,1);

SetIndexArrow(1,233);

SetIndexArrow(0,234);

SetIndexBuffer(0,SwingHiDraw);

SetIndexBuffer(1,SwingLoDraw);

SetIndexBuffer(2,SwingHiBar);

SetIndexBuffer(3,SwingLoBar);

SetIndexBuffer(4,SwingHi);

SetIndexBuffer(5,SwingLo);

double ticksize = MarketInfo (Symbol(),MODE_TICKSIZE);

if (ticksize == .00001 || ticksize == .001)

pips = ticksize * 10;

else pips = ticksize;

return(0);

}

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

//| Custom indicator iteration function |

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

int start()

{

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

//| Find Hi and Lo Bars |

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

int counted_bars = IndicatorCounted();

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

if (counted_bars>0) counted_bars--;

int uncountedbars = Bars - counted_bars;

//---

for (int i=4;i<uncountedbars;i++)

{

if (High > High

&& High > High

&& High > High

&& High > High

&& High > High

&& High > High)

{

SwingHiBar = 1;

SwingHi = High;

SwingCount = SwingCount + 1;

ObjectCreate("Text",OBJ_TEXT,0,0,0);

ObjectSet("Text",OBJPROP_TIME1,Time);

ObjectSet("Text",OBJPROP_PRICE1,SwingHi+20*pips);

ObjectSetString(0,"Text",OBJPROP_TEXT,SwingCount);

ObjectSet("Text",OBJPROP_COLOR,clrGreen);

}

else

{ SwingHiBar=0; SwingHi=0;

SwingHiDraw=0;

if (Low < Low

&& Low < Low

&& Low < Low

&& Low < Low

&& Low < Low

&& Low < Low)

{

SwingLoBar = 1;

SwingLo = Low;

SwingCount = SwingCount + 1;

ObjectCreate("Text",OBJ_TEXT,0,0,0);

ObjectSet("Text",OBJPROP_TIME1,Time);

ObjectSet("Text",OBJPROP_PRICE1,SwingLo-20*_Point);

ObjectSetString(0,"Text",OBJPROP_TEXT,SwingCount);

ObjectSet("Text",OBJPROP_COLOR,clrRed);

}

else {SwingLoBar = 0; SwingLo=0;

SwingLoDraw=0;}

}

}

return(0);

}

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

Il était là, mais juste un (dans le passé)

Utilisez ceci :

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

//| SwingHighLow.mq4 |

//| Dream Reality Productions, LLC |

//| http://www.dreamrealityproductions.com |

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

#property copyright "Dream Reality Productions, LLC"

#property link "http://www.dreamrealityproductions.com"

#property indicator_chart_window

#property indicator_buffers 6

#property indicator_color1 Orange

#property indicator_color2 Aqua

double SwingHiBar[];

double SwingLoBar[];

double SwingHiDraw[];

double SwingLoDraw[];

double SwingHi[];

double SwingLo[];

static int SwingCount=0;

double pips;

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

//| Custom indicator initialization function |

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

int init()

{

SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID,1);

SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,1);

SetIndexArrow(1,233);

SetIndexArrow(0,234);

SetIndexBuffer(0,SwingHiDraw);

SetIndexBuffer(1,SwingLoDraw);

SetIndexBuffer(2,SwingHiBar);

SetIndexBuffer(3,SwingLoBar);

SetIndexBuffer(4,SwingHi);

SetIndexBuffer(5,SwingLo);

double ticksize = MarketInfo (Symbol(),MODE_TICKSIZE);

if (ticksize == .00001 || ticksize == .001)

pips = ticksize * 10;

else pips = ticksize;

return(0);

}

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

//| Custom indicator iteration function |

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

int start()

{

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

//| Find Hi and Lo Bars |

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

int counted_bars = IndicatorCounted();

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

if (counted_bars>0) counted_bars--;

int uncountedbars = Bars - counted_bars;

//---

for (int i=4;i<uncountedbars;i++)

{

if (High > High

&& High > High

&& High > High

&& High > High

&& High > High

&& High > High)

{

SwingHiBar = 1;

SwingHi = High;

SwingCount = SwingCount + 1;

ObjectCreate("Text"+Time,OBJ_TEXT,0,0,0);

ObjectSet("Text"+Time,OBJPROP_TIME1,Time);

ObjectSet("Text"+Time,OBJPROP_PRICE1,SwingHi+20*_Point);

ObjectSetString(0,"Text"+Time,OBJPROP_TEXT,SwingCount);

ObjectSet("Text"+Time,OBJPROP_COLOR,clrGreen);

}

else

{ SwingHiBar=0; SwingHi=0;

SwingHiDraw=0;

if (Low < Low

&& Low < Low

&& Low < Low

&& Low < Low

&& Low < Low

&& Low < Low)

{

SwingLoBar = 1;

SwingLo = Low;

SwingCount = SwingCount + 1;

ObjectCreate("Text"+Time,OBJ_TEXT,0,0,0);

ObjectSet("Text"+Time,OBJPROP_TIME1,Time);

ObjectSet("Text"+Time,OBJPROP_PRICE1,SwingLo-20*_Point);

ObjectSetString(0,"Text"+Time,OBJPROP_TEXT,SwingCount);

ObjectSet("Text"+Time,OBJPROP_COLOR,clrRed);

}

else {SwingLoBar = 0; SwingLo=0;

SwingLoDraw=0;}

}

}

return(0);

}

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

cher mladen, mrtools j'attends avec impatience votre réponse à mes questions concernant la modification des paramètres de l'indicateur dans le post ci-dessus.

J'espère que vous me répondrez quand vous en aurez le temps.

Merci.

 
brijeshsinh:
Bonjour,

Est-ce que mladen, mrtools peuvent m'aider à ajouter les paramètres suivants pour l'indicateur--- Rsi bar chart v2.02 mtf & alerts

--Peut-on colorer différemment les barres lorsqu'elles passent au-dessus ou au-dessous de la ligne médiane (niveau 50 pour la perspective rsi) ; -- c'est à dire au-dessus de la ligne 50 une couleur et au-dessous du niveau 50 une couleur différente.

--Peut-on ajouter une moyenne mobile à l'indicateur dans une fenêtre séparée, comme nous pouvons ajouter une moyenne mobile au graphique principal (comme on le voit dans l'image ci-dessous).

Je joins ici l'indicateur et l'image.

rsi_bar_chart_v2.02_mtf_amp_alerts.mq4

Merci d'avance, votre aide sera très appréciée.

Cet indicateur a 4 valeurs (il est combiné à partir de 4 valeurs rsi différentes). Cela exclut le croisement - puisqu'il n'y a pas une valeur qui peut être utilisée comme critère pour le croisement d'une valeur.

Quant à la moyenne, c'est la même chose que pour les croisements : puisqu'il y a 4 valeurs rsi, la moyenne n'a pas de valeur unique à laquelle s'appliquer.

 

merci mladen de m'avoir répondu et d'avoir trouvé du temps pour moi. je vous remercie pour votre aide.

 

Bonjour,

mladen, mr tools pouvez-vous s'il vous plaît aider à changer les paramètres suivants dans l'indicateur FXUltraTrend affiché ci-dessous à

--- Afficher dans une fenêtre séparée sous forme de ligne (ou d'histogramme) avec des flèches pour montrer le changement de couleur si possible (par défaut, dans les paramètres actuels, il peint les barres sur le graphique principal).

---- et si possible ajouter une colonne pour les différents paramètres, afin qu'ils puissent être modifiés selon nos souhaits. (dans le mode actuel par défaut, il n'y a pas de colonne pour ajouter des paramètres).

Je joins l'indicateur ci-dessous et son image pour vous

fxultratrend.mq4

J'espère que vous ne m'en voudrez pas de prendre un peu de temps pour vous, mais vous faites un excellent travail pour quelqu'un comme nous qui sommes nouveaux sur cette plateforme et qui ne connaissons pas la programmation.

Vous méritez vraiment d'être remercié par moi et par tous les membres de ce forum pour vos précieux efforts.

Merci pour la réponse rapide au message précédent.

Dossiers :
444.png  56 kb
 

Mettre en œuvre ; indicateur NonLag_Schaff_TrendCycle :

Bonjour Pro-Coders,

Je me demande si quelqu'un peut m'aider à mettre en place l'indicateur NonLag_Schaff_TrendCycle.

Externes de l'indicateur :

extern int FastLength = 23 ;

extern int SlowLength = 50 ;

extern int StcPeriod = 10 ;

extern int MacdPrice = PRICE_CLOSE ;

extern bool Interpolate = true ;

extern bool MultiColor = true ;

Tampons d'indicateurs :

IndicatorBuffers(8) ;

SetIndexBuffer(0,stcBuffer) ;

SetIndexBuffer(1,stcBufferUA) ;

SetIndexBuffer(2,stcBufferUB) ;

SetIndexBuffer(3,macdBuffer) ;

SetIndexBuffer(4,fastKBuffer) ;

SetIndexBuffer(5,fastDBuffer) ;

SetIndexBuffer(6,fastKKBuffer) ;

SetIndexBuffer(7,trend) ;

J'essaie de faire quelque chose comme

double STC1_c=iCustom(Symbol(),0, "NonLag_Schaff_TrendCycle",FastLength,SlowLength,StcPeriod,MacdPrice,Interpolate,0,bar) ;

double STC2_c=iCustom(Symbol(),0, "NonLag_Schaff_TrendCycle",FastLength,SlowLength,StcPeriod,MacdPrice,Interpolate,0,bar+1) ;

if((STC1_c>15 && STC2_c85 && STC2_c BUY

if((STC1_c15)||(STC1_c85) -> VENDRE

Mais je reçois un message d'erreur :

Error : NonLag_Schaff_TrendCycle a été supprimé.

Je suppose que j'ai peut-être mal lu les tampons. Quelqu'un a-t-il une suggestion à faire ?

Merci d'avance !

Raison: