1 Pi?ce (s) jointe (s) Bonjour les amis,
Je ne suis pas un codeur expert et confonds sur la fa?on d'ajouter de la couleur verte pour l'histogramme positif et la couleur rouge pour l'histogramme n?gatif sur cet indieur.
Le code de l'indieur:
Code ins?r?/ --------------------------------------------- --------------------- /| CandleAverage_v1.mq4 |/| Copyright ? 2006, Forex-TSD.com |/| ??crit par IgorAD, igorad2003 @ yahoo.co.uk |/| http://finance.groups.yahoo.com/group/TrendLaboratory |/ ----------------------------------------------- ------------------- copyright #property Copyright ? 2006, Forex-TSD.com #property lien http://www.forex-tsd.com/#property indior_separate_window #property indior_buffers 1 #property indior_color1 DeepSkyBlue/---- param?tres d'entr?e extern int Longueur = 31; extern int H_period = 25; extern int L_period = 27; extern int C_period = 9;/---- buffers double CandleAvg # 91; # 93 ;; double BarValue # 91; # 93 ;;/ ----------------------------------------------- ------------------- /| Fonction d'initialisation d'indieur personnalis? |/ ----------------------------------------------- ------------------- int init () {//---- indieurs IndiorBuffers (2); SetIndexStyle (0, DRAW_HISTOGRAM); SetIndexBuffer (0, CandleAvg); SetIndexBuffer (1, BarValue);/---- nom pour DataWindow et indieur subwindow label cha?ne nom_br?ve = CandleAverage ( Length ); IndiorShortName (nom abr?g?); SetIndexLabel (0, CandleAvg); SetIndexDrawBegin (0, Length);/---- return (0); }/ ---------------------------------------------- -------------------- /| Fonction d'it?ration d'indieur personnalis? |/ ----------------------------------------------- ------------------- int d?but () {int d?calage, limite, counted_bars = IndiorCounted (); double UpDel, DnDel, H, L, C;/---- if (counted_barslt; 0) return (-1); if (counted_bars == 0) limite = Bars-Longueur-1;/---- la derni?re barre compt?e sera recompt?e si (counted_barsgt; 0) limit = Bars-counted_bars; limite--; pour (shift = limite; shiftgt; = 0; shift--) {H = iMA (NULL, 0, H_p?riode, 0, MODE_EMA, PRICE_HIGH, shift); L = iMA (NULL, 0, L_p?riode, 0, MODE_EMA, PRICE_LOW, shift); C = iMA (NULL, 0, C_p?riode, 0, MODE_EMA, PRICE_CLOSE, shift); UpDel = H - C; DnDel = C - L; si (UpDel lt; DnDel) BarValue # 91, d?calage # 93; = 1; if (UpDel gt; DnDel) BarValue # 91; d?calage # 93; = -1; if (UpDel == DnDel) BarValue # 91; d?calage # 93; = 0; } pour (shift = limite; shiftgt; = 0; shift--) {CandleAvg # 91; shift # 93; = iMAOnArray (BarValue, 0, Length, 0, MODE_SMA, d?calage); }/---- return (0); }/ ---------------------------------------------- -------------------- J'ai essay? de changer le code comme ci-dessous:
Code ins?r? #property indior_separate_window #property indior_buffers 2 #property indior_color1 DeepSkyBlue #property indior_color2 Rouge Mais ne fonctionnait pas car la valeur de l'histogramme n'?tait stock?e que dans 1 tampon, CandleAvg.
Comment s?parer la valeur positive et n?gative du tampon CandleAvg et ajouter une couleur verte rouge?
Veuillez nous conseiller
Merci pour l'aide.