Soo...da ich schon wieder am ende meiner geistigen Resourcen bin...
folgendes Bild:
Ich habe mir eine Art "Signalampel" gebaut (gebastelt trifft es vermutlich eher)
Ich habe dafür OBJ_RECTANGLE_LABEL verwendet und diese oben rechts in der ecke (mit ein paar pixel abstand zueinander) platziert - das funktioniert auch wunderbar
aber
ich kann bei den RECTANGLE_LABEL die pixel von oben rechts aus der ecke angeben (dort ist deren Ursprung)
jetzt habe ich bezeichnungen für die Timeframes machen wollen.
diese werden aber von links oben definiert was natürlich zu gewissen problemen führt ... und ich verstehe offen gesagt nicht, wieso die zwei unterschiedliche bezüge haben...achso dass das MN woanders sitzt weiß ich - da habe ich es ausprobiert wo der ursprung liegt...
hier noch die kästchen
Code:
void DrawBox(long chart_ID=0, //chart ID
string name="", //label name
int sub_window=0, //subwindow index
int x=10, //X coordinate
int y=10, //Y coordinate
int width=10, //width
int height=10, //height
color back_clr=clrWheat, //background color
ENUM_BORDER_TYPE border=BORDER_FLAT, //border type
ENUM_BASE_CORNER corner=CORNER_RIGHT_UPPER, //chart corner for anchoring
bool selection=true, //selectable
bool hidden=false, //hidden in list
)
{
name=labfix+name;
//--- reset the error value
ResetLastError();
//--- create a rectangle label
if(ObjectFind(0,name)<0)
{
ObjectCreate(chart_ID,name,OBJ_RECTANGLE_LABEL,sub_window,0,0);
}else{
//--- set label coordinates
ObjectSetInteger(chart_ID,name,OBJPROP_XDISTANCE,x);
ObjectSetInteger(chart_ID,name,OBJPROP_YDISTANCE,y);
//--- set label size
ObjectSetInteger(chart_ID,name,OBJPROP_XSIZE,width);
ObjectSetInteger(chart_ID,name,OBJPROP_YSIZE,height);
//--- set background color
ObjectSetInteger(chart_ID,name,OBJPROP_BGCOLOR,back_clr);
//--- set border type
ObjectSetInteger(chart_ID,name,OBJPROP_BORDER_TYPE,border);
//--- set the chart's corner, relative to which point coordinates are defined
ObjectSetInteger(chart_ID,name,OBJPROP_CORNER,corner);
//--- enable (true) or disable (false) the mode of moving the label by mouse
ObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE,selection);
//--- hide (true) or display (false) graphical object name in the object list
ObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidden);
//--- successful execution
return;
}}
und hier der versuch der labels
Code:
void DrawLabel(
long chart_ID=0, //Charts ID
string name="", //Labelname
int sub_window=0, //which window
int x=10, //x coordinate
int y=10, //y coordinate
ENUM_BASE_CORNER corner=CORNER_RIGHT_UPPER,
string text="test", //which text in there
string font="Arial", //which font
int font_size=10, //font size
color font_clr=clrGray,//Font color
ENUM_ANCHOR_POINT anchor=ANCHOR_RIGHT_UPPER,
bool back=false, //in the background?
bool selection=false, //selectable?
bool hidden=true, //hidden?
)
{
name=labfix+name;
//--- reset the error value
ResetLastError();
//--- create a rectangle label
if(ObjectFind(0,name)<0)
{
ObjectCreate(chart_ID,name,OBJ_LABEL,sub_window,0,0);
}else{
//--- set label coordinates
ObjectSetInteger(chart_ID,name,OBJPROP_XDISTANCE,x);
ObjectSetInteger(chart_ID,name,OBJPROP_YDISTANCE,y);
//--- set text
ObjectSetString(chart_ID,name,OBJPROP_TEXT,text);
//--- set text font
ObjectSetString(chart_ID,name,OBJPROP_FONT,font);
//--- set font size
ObjectSetInteger(chart_ID,name,OBJPROP_FONTSIZE,font_size);
//--- set font color
ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,font_clr);
//--- successful execution
return;
}}
und natürlich einen aufruf dazu...
Code:
if(stmn=="Stark Bärisch")
{
clrmn=clrRed;
DrawBox(0,"MN Box",0,30,150,25,15,clrmn,BORDER_SUNKEN,CORNER_RIGHT_UPPER,false,true);
DrawLabel(0,"MN Label",0,1250,150,CORNER_RIGHT_UPPER,"MN","Arial",9,clrGray,ANCHOR_LEFT,false,false,true);
}