Récupération Variable Indic Pour Création Ea
Forex Forum > Français > Ressources > Logiciels et matériels
testman
Salut à tous !

J'aimerais automatiser mes trades grace à l'indicateur THVTrix, notamment grâce au BUY ALERT / SELL ALERT et au TRIX EXIT ALARM généré via une popup de l'indic.

Voici le code de l'indicateur convernant ces popup :

CODE
   if (AlertOnTrixSigCross) {
      if (g_ibuf_224[2] < g_ibuf_212[2] && g_ibuf_224[1] > g_ibuf_212[1] && g_bars_252 < Bars) {
         if (AnalyzeLabelonoff) l_text_428 = "Analyze Buy";
         ObjectDelete("Order_Crossing_Label");
         ObjectCreate("Order_Crossing_Label", OBJ_LABEL, AnalyzeLabelWindow, 0, 0);
         ObjectSet("Order_Crossing_Label", OBJPROP_CORNER, 3);
         ObjectSet("Order_Crossing_Label", OBJPROP_XDISTANCE, 2);
         ObjectSet("Order_Crossing_Label", OBJPROP_YDISTANCE, 25);
         ObjectSet("Order_Crossing_Label", OBJPROP_COLOR, Red);
         ObjectSetText("Order_Crossing_Label", l_text_428, 12, "Arial Black", Lime);
         ls_404 = gs_256 + " " + Symbol() + " " + TF2Str(Period()) + " BUY ALARM @ " + TimeToStr(TimeCurrent(), TIME_DATE|TIME_MINUTES);
         DoAlerts(ls_404, ls_404);
         g_bars_252 = Bars;
         if (SoundAlerts) PlaySound("analyze buy.wav");
      } else {
         if (g_ibuf_224[2] > g_ibuf_212[2] && g_ibuf_224[1] < g_ibuf_212[1] && g_bars_252 < Bars) {
            if (AnalyzeLabelonoff) l_text_428 = "Analyze Sell";
            ObjectDelete("Order_Crossing_Label");
            ObjectCreate("Order_Crossing_Label", OBJ_LABEL, AnalyzeLabelWindow, 0, 0);
            ObjectSet("Order_Crossing_Label", OBJPROP_CORNER, 3);
            ObjectSet("Order_Crossing_Label", OBJPROP_XDISTANCE, 2);
            ObjectSet("Order_Crossing_Label", OBJPROP_YDISTANCE, 25);
            ObjectSet("Order_Crossing_Label", OBJPROP_COLOR, Red);
            ObjectSetText("Order_Crossing_Label", l_text_428, 12, "Arial Black", Red);
            ls_404 = gs_256 + " " + Symbol() + " " + TF2Str(Period()) + " SELL ALARM @ " + TimeToStr(TimeCurrent(), TIME_DATE|TIME_MINUTES);
            DoAlerts(ls_404, ls_404);
            g_bars_252 = Bars;
            if (SoundAlerts) PlaySound("analyze sell.wav");
         }
      }
   }
   if (AlertOnSlopeChange) {
      if (g_ibuf_224[1] > g_ibuf_212[1] && g_ibuf_228[2] != EMPTY_VALUE && g_ibuf_228[1] == EMPTY_VALUE && g_bars_252 < Bars) {
         if (AnalyzeLabelonoff) l_text_428 = "Analyze Exit";
         if (ObjectFind("Alarm_Crossing_Label" + Time[0]) == -1) {
            ObjectDelete("Alarm_Crossing_Label");
            ObjectCreate("Alarm_Crossing_Label" + Time[0], OBJ_LABEL, AnalyzeLabelWindow, 0, 0);
            ObjectSet("Alarm_Crossing_Label" + Time[0], OBJPROP_CORNER, 3);
            ObjectSet("Alarm_Crossing_Label" + Time[0], OBJPROP_XDISTANCE, 1);
            ObjectSet("Alarm_Crossing_Label" + Time[0], OBJPROP_YDISTANCE, 43);
            ObjectSet("Alarm_Crossing_Label" + Time[0], OBJPROP_COLOR, Gold);
            ObjectSetText("Alarm_Crossing_Label" + Time[0], l_text_428, 12, "Arial Black", Gold);
         }
        ls_404 = gs_256 + " " + Symbol() + " " + TF2Str(Period()) + " TRIX EXIT ALARM @ " + TimeToStr(TimeCurrent(), TIME_DATE|TIME_MINUTES);
         DoAlerts(ls_404, ls_404);
         g_bars_252 = Bars;
         if (SoundAlerts) PlaySound("analyze exit.wav");
      } else {
         if (g_ibuf_224[1] < g_ibuf_212[1] && g_ibuf_232[2] != EMPTY_VALUE && g_ibuf_232[1] == EMPTY_VALUE && g_bars_252 < Bars) {
            if (AnalyzeLabelonoff) l_text_428 = "Analyze Exit";
            if (ObjectFind("Alarm_Crossing_Label" + Time[0]) == -1) {
               if (AnalyzeLabelonoff) {
                  ObjectDelete("Alarm_Crossing_Label");
                  ObjectCreate("Alarm_Crossing_Label" + Time[0], OBJ_LABEL, AnalyzeLabelWindow, 0, 0);
                  ObjectSet("Alarm_Crossing_Label" + Time[0], OBJPROP_CORNER, 3);
                  ObjectSet("Alarm_Crossing_Label" + Time[0], OBJPROP_XDISTANCE, 1);
                  ObjectSet("Alarm_Crossing_Label" + Time[0], OBJPROP_YDISTANCE, 43);
                  ObjectSet("Alarm_Crossing_Label" + Time[0], OBJPROP_COLOR, Gold);
                  ObjectSetText("Alarm_Crossing_Label" + Time[0], l_text_428, 12, "Arial Black", Gold);
               }
            }
            ls_404 = gs_256 + " " + Symbol() + " " + TF2Str(Period()) + " TRIX EXIT ALARM @ " + TimeToStr(TimeCurrent(), TIME_DATE|TIME_MINUTES);
            DoAlerts(ls_404, ls_404);
            g_bars_252 = Bars;
            if (SoundAlerts) PlaySound("analyze exit.wav");
         }
      }



J'aimerais récupéré la texte généré par les DoAlerts(XXX, YYY);

Quel serait le code à utiliser dans l'ea ou à modifier sur l'indic ?

Par avance merci !
damtoul
Hello,

soit tu incorpores le code de calcul de l'indic dans l'EA direct, soit tu utilises une variable globale que tu places juste après un DoAlert. Cet GV est lue par l'EA à chaque tick et prendra la décision en fonction.

http://docs.mql4.com/globals

Dans l'indic : un globalvarset
Dans l'EA : un globalvarget.

Et roulez jeunesse.
testman
Merci à toi mataf_wink.gif
damtoul
j'imagine que tu t'en sors avec la GV? Vu que j'en ai vu une qui se promenait sur l'autre post....
dinhero
salut,

tu utilise mq4 ?

1. Tu appelle l'indicateur dans le code de ton EA grace a la commance icustom

2. Tu determine les index de l'indicateur, ceux qui conditionne le lancement de l'index.

3. Tu utilises les resultats des index dans ton EA.

Tu n'as ný besoin de modifier le code de l'indicateur, ni besoin d'inclure le code de fonction de l'indicateur dans ton EA. juste utiliser les resultat de l'indic.

happy coding and make money
damtoul
Pas sur que dans son cas la commande iCustom soit la plus indiquée. Son indic semble lui sortir des signaux complexes et non une valeur au tick ou à la barre. Ca risque d'être un peu lourd avec iCustom. Enfin bon n'ayant pas le code entier de l'indic ce n'est qu'une remarque... mataf_siffle.gif

jlpi
voyant le code de l'indic, ceci est du code décompilé ...
damtoul
A quoi tu vois ça? Au bordel ambiant et aux parenthèses mal placées?
C'est peut-être un gougnaffier qui a programmé cet indic? tongue.gif
forcerelative
Bonjour JLPI,
Je n'arrive pas à vous envoyer de mail à travers la plateforme,
J'aimerais entrer en contact avec vous rapidement pour la création de 2 EA.
Je suis un particulier.
Voici mon Mail :
o.dutel@gmail.com
Merci d'avance.
Forcerelative