Tous ceux qui programment connaissent certainement la fonction Comment() qui permet d'afficher quelques informations directement sur le graphique et je ne doute pas que bon nombre d'entre vous ont pesté contre l'illisibilité de ces informations lorsque le cours et les indicateurs viennent s'afficher derrière.
Pour éviter ce problème et avoir un affichage clair quelle que soit la situation voici une fonction qui vous sera utile :
Pour éviter ce problème et avoir un affichage clair quelle que soit la situation voici une fonction qui vous sera utile :
Code
//+------------------------------------------------------------------+
//| Panel drawing function |
//+------------------------------------------------------------------+
void drawPanel(int panelWidth = 1, int panelHeight = 2, int panelTop = 10, int panelLeft = 10, color bg = 0x101010, color shade = DimGray, color bright = Silver) {
//----
string name;
int h, w;
ObjectsDeleteAll(0);
name = "0PANEL";
ObjectCreate(name, OBJ_LABEL, 0, 0, 0.0);
ObjectSetText(name, "n", 4, "Wingdings", shade); // plain square
ObjectSet(name, OBJPROP_CORNER, 0);
ObjectSet(name, OBJPROP_XDISTANCE, panelLeft + 4);
ObjectSet(name, OBJPROP_YDISTANCE, panelTop + 13); // */
for (h = 0; h < panelHeight; h++) {
name = "0PANEL"+w+"_"+h;
ObjectCreate(name, OBJ_LABEL, 0, 0, 0.0);
ObjectSetText(name, "n", 48, "Wingdings", shade); // plain square
ObjectSet(name, OBJPROP_CORNER, 0);
ObjectSet(name, OBJPROP_XDISTANCE, 0 * 36 + panelLeft - 1);
ObjectSet(name, OBJPROP_YDISTANCE, h * 37 + panelTop + 1);
}
for (w = 0; w < panelWidth; w++) {
name = "0PANEL"+w+"_"+h;
ObjectCreate(name, OBJ_LABEL, 0, 0, 0.0);
ObjectSetText(name, "n", 48, "Wingdings", shade); // plain square
ObjectSet(name, OBJPROP_CORNER, 0);
ObjectSet(name, OBJPROP_XDISTANCE, w * 36 + panelLeft + 1);
ObjectSet(name, OBJPROP_YDISTANCE, 0 * 37 + panelTop - 1);
}
w--;
for (h = 0; h < panelHeight; h++) {
name = "1PANEL"+w+"_"+h;
ObjectCreate(name, OBJ_LABEL, 0, 0, 0.0);
ObjectSetText(name, "n", 48, "Wingdings", bright); // plain square
ObjectSet(name, OBJPROP_CORNER, 0);
ObjectSet(name, OBJPROP_XDISTANCE, w * 36 + panelLeft + 1);
ObjectSet(name, OBJPROP_YDISTANCE, h * 37 + panelTop + 1);
}
h--;
for (w = 0; w < panelWidth; w++) {
name = "1PANEL"+w+"_"+h;
ObjectCreate(name, OBJ_LABEL, 0, 0, 0.0);
ObjectSetText(name, "n", 48, "Wingdings", bright); // plain square
ObjectSet(name, OBJPROP_CORNER, 0);
ObjectSet(name, OBJPROP_XDISTANCE, w * 36 + panelLeft + 1);
ObjectSet(name, OBJPROP_YDISTANCE, h * 37 + panelTop + 1);
}
for (h = 0; h < panelHeight; h++)
for (w = 0; w < panelWidth; w++) {
name = "2PANEL"+w+"_"+h;
ObjectCreate(name, OBJ_LABEL, 0, 0, 0.0);
ObjectSetText(name, "n", 48, "Wingdings", bg); // plain square
ObjectSet(name, OBJPROP_CORNER, 0);
ObjectSet(name, OBJPROP_XDISTANCE, w * 36 + panelLeft);
ObjectSet(name, OBJPROP_YDISTANCE, h * 37 + panelTop);
}
//----
}