Salut ? tous,
J'ai un probl?me, je ne sais pas comment traiter ou d?crire correctement, d?sol?, mais je vais essayer.
J'ai ?crit un EA avec des boutons sur le graphique pour m'aider dans mon trading manuel, quand l'EA est charg? sur le graphique, tout va bien, je peux cliquer sur les boutons et esp?rer obtenir les r?sultats souhait?s apr?s un certain temps (random), les boutons qui utilisent le falsetrue OBJPROP_STATE reviennent ? leur valeur par d?faut, ce qui est faux m?me s'ils ont l'air vrais (cliqu?) sur le graphique lui-m?me.
J'ai pris le code des boutons d'un EA quelqu'un a ?t? pay? pour coder pour moi, peut-?tre que ce n'?tait pas bien ?crit, peut-?tre que je ne sais pas comment bien l'utiliser, je ne sais pas mais cela me rend fou en le d?boguant , tout fonctionne aussi longtemps que je le regarde, je pars pendant une heure (parfois plus longtemps ou plus court que ?a), je regarde le graphique et bien que tout semble bien aller, rien ne fonctionne tant que je ne clique pas desbots (d?sol?, pas s?r comment on l'appelle) boutons.
Voici le code pour les boutons
Merci.
Code ins?r?/ --------------------------------------------- --------------------- /| Fonction d'initialisation experte |/ ----------------------------------------------- ------------------- int OnInit () {ObjectCreate (ChartID (), Longs Disabled, OBJ_BUTTON, 0,0,0); ObjectSet (Longs d?sactiv?, OBJPROP_BGCOLOR, clrRed); ObjectSet (Longs d?sactiv?, OBJPROP_CORNER, 1); ObjectSet (Longs d?sactiv?, OBJPROP_YDISTANCE, 60); ObjectSet (Longs d?sactiv?, OBJPROP_XDISTANCE, 120); ObjectSet (Longs Disabled, OBJPROP_XSIZE, 120); ObjectSet (Longs d?sactiv?, OBJPROP_YSIZE, 30); ObjectSetString (ChartID (), Longs d?sactiv?, OBJPROP_TEXT, Longs d?sactiv?); ObjectSet (Longs d?sactiv?, OBJPROP_COLOR, blanc); ObjectCreate (ChartID (), Shorts Disabled, OBJ_BUTTON, 0,0,0); ObjectSet (Shorts Disabled, OBJPROP_BGCOLOR, clrRed); ObjectSet (Shorts Disabled, OBJPROP_CORNER, 1); ObjectSet (Shorts Disabled, OBJPROP_YDISTANCE, 90); ObjectSet (Shorts Disabled, OBJPROP_XDISTANCE, 120); ObjectSet (Shorts Disabled, OBJPROP_XSIZE, 120); ObjectSet (Shorts Disabled, OBJPROP_YSIZE, 30); ObjectSetString (ChartID (), Shorts Disabled, OBJPROP_TEXT, Shorts Disabled); ObjectSet (Shorts Disabled, OBJPROP_COLOR, White); ObjectCreate (ChartID (), Fermer tout, OBJ_BUTTON, 0,0,0); ObjectSet (Fermer tout, OBJPROP_BGCOLOR, clrRed); ObjectSet (Close All, OBJPROP_CORNER, 1); ObjectSet (Close All, OBJPROP_YDISTANCE, 120); ObjectSet (Close All, OBJPROP_XDISTANCE, 120); ObjectSet (Close All, OBJPROP_XSIZE, 120); ObjectSet (Close All, OBJPROP_YSIZE, 30); ObjectSetString (ChartID (), Fermer tout, OBJPROP_TEXT, Fermer tout); ObjectSet (Close All, OBJPROP_COLOR, White); ObjectCreate (ChartID (), Disabled, OBJ_BUTTON, 0,0,0); ObjectSet (Disabled, OBJPROP_BGCOLOR, clrRed); ObjectSet (Disabled, OBJPROP_CORNER, 1); ObjectSet (Disabled, OBJPROP_YDISTANCE, 150); ObjectSet (Disabled, OBJPROP_XDISTANCE, 120); ObjectSet (Disabled, OBJPROP_XSIZE, 120); ObjectSet (Disabled, OBJPROP_YSIZE, 30); ObjectSetString (ChartID (), Disabled, OBJPROP_TEXT, Disabled); ObjectSet (Disabled, OBJPROP_COLOR, White); ObjectCreate (ChartID (), Buy, OBJ_BUTTON, 0,0,0); ObjectSet (Buy, OBJPROP_BGCOLOR, clrGreen); ObjectSet (Buy, OBJPROP_CORNER, 1); ObjectSet (Buy, OBJPROP_YDISTANCE, 180); ObjectSet (Buy, OBJPROP_XDISTANCE, 120); ObjectSet (Buy, OBJPROP_XSIZE, 120); ObjectSet (Buy, OBJPROP_YSIZE, 30); ObjectSetString (ChartID (), Buy, OBJPROP_TEXT, Buy); ObjectSet (Buy, OBJPROP_COLOR, White); ObjectCreate (ChartID (), Sell, OBJ_BUTTON, 0,0,0); ObjectSet (Sell, OBJPROP_BGCOLOR, clrGreen); ObjectSet (Sell, OBJPROP_CORNER, 1); ObjectSet (Sell, OBJPROP_YDISTANCE, 210); ObjectSet (Sell, OBJPROP_XDISTANCE, 120); ObjectSet (Sell, OBJPROP_XSIZE, 120); ObjectSet (Sell, OBJPROP_YSIZE, 30); ObjectSetString (ChartID (), Sell, OBJPROP_TEXT, Sell); ObjectSet (Sell, OBJPROP_COLOR, White); retourner (INIT_SUCCEEDED); }/ ---------------------------------------------- -------------------- / -------------------------- ---------------------------------------- /| Fonction ChartEvent|/ ----------------------------------------------- ------------------- void OnChartEvent (const int id, const long lparam, const double dparam, const string sparam) {if (id == CHARTEVENT_OBJECT_CLICK) {if ( sparam == Longs D?sactiv?) {if (AllowLongs) {AllowLongs = false; ObjectSetInteger (ChartID (), Longs d?sactiv?, OBJPROP_STATE, false); ObjectSetInteger (ChartID (), Longs d?sactiv?s, OBJPROP_BGCOLOR, clrRed); ObjectSetString (ChartID (), Longs d?sactiv?, OBJPROP_TEXT, Longs d?sactiv?); } else {AllowLongs = true; ObjectSetInteger (ChartID (), Longs d?sactiv?, OBJPROP_STATE, true); ObjectSetInteger (ChartID (), Longs d?sactiv?, OBJPROP_BGCOLOR, clrGreen); ObjectSetString (ChartID (), Longs d?sactiv?, OBJPROP_TEXT, Longs Enabled); }} if (sparam == Shorts Disabled) {if (AllowShorts) {AllowShorts = false; ObjectSetInteger (ChartID (), Shorts Disabled, OBJPROP_STATE, false); ObjectSetInteger (ChartID (), Shorts d?sactiv?s, OBJPROP_BGCOLOR, clrRed); ObjectSetString (ChartID (), Shorts Disabled, OBJPROP_TEXT, Shorts Disabled); } else {AllowShorts = true; ObjectSetInteger (ChartID (), Shorts Disabled, OBJPROP_STATE, true); ObjectSetInteger (ChartID (), Shorts Disabled, OBJPROP_BGCOLOR, clrGreen); ObjectSetString (ChartID (), Shorts Disabled, OBJPROP_TEXT, Shorts Enabled); }} if (sparam == Close All) {CloseAll (); ObjectSetInteger (ChartID (), Fermer tout, OBJPROP_STATE, false); } if (sparam == Disabled) {if (NotDisabled) {NotDisabled = false; ObjectSetInteger (ChartID (), Disabled, OBJPROP_STATE, false); ObjectSetInteger (ChartID (), Disabled, OBJPROP_BGCOLOR, clrRed); ObjectSetString (ChartID (), Disabled, OBJPROP_TEXT, Disabled); } else {NotDisabled = true; ObjectSetInteger (ChartID (), Disabled, OBJPROP_STATE, true); ObjectSetInteger (ChartID (), Disabled, OBJPROP_BGCOLOR, clrGreen); ObjectSetString (ChartID (), Disabled, OBJPROP_TEXT, Enabled); }} if (sparam == Buy) {if (NotDisabled) {UpCycle (); } ObjectSetInteger (ChartID (), Buy, OBJPROP_STATE, false); } if (sparam == Sell) {if (NotDisabled) {DownCycle (); } ObjectSetInteger (ChartID (), Sell, OBJPROP_STATE, false); }}}/ -------------------------------------------- ----------------------