Can you make an Arrow Object In the Corner of your screen?

Post Reply
chiefkeef
Trader
Posts: 13
Joined: Mon Sep 07, 2020 8:09 pm

Can you make an Arrow Object In the Corner of your screen?

Post by chiefkeef »

Hi guys.

Can you make an arrow obejct to be always present on the top left corner. I tried doing it, but its not working.

Code: Select all

  ObjectCreate("MAIN",OBJ_ARROW_UP,0,0,0);
ObjectSet("MAIN",OBJPROP_CORNER,1);
ObjectSet("MAIN",OBJPROP_XDISTANCE,270);
ObjectSet("MAIN",OBJPROP_YDISTANCE,59);
ObjectSet("MAIN",OBJPROP_WIDTH,10);
ObjectSet("MAIN",OBJPROP_BORDER_TYPE,BORDER_FLAT);
ObjectSet("MAIN",OBJPROP_COLOR,clrWhite);
ObjectSet("MAIN",OBJPROP_BGCOLOR,clrMidnightBlue);
User avatar
renexxxx
Trader
Posts: 860
Joined: Sat Dec 31, 2011 3:48 am

Can you make an Arrow Object In the Corner of your screen?

Post by renexxxx »

An object of type OBJ_ARROW_UP is not a label. Instead it is positioned relative to the time and price parameters in the ObjectCreate() function.

If you want to place a label on the chart, relative to an x and y coordinate, you need to use the OBJ_LABEL object type. So, the code will look something like this:

Code: Select all

   if (ObjectFind("MAIN") >= 0) ObjectDelete("MAIN");
   ObjectCreate("MAIN",OBJ_LABEL,0,0,0);
   ObjectSetString(ChartID(), "MAIN",OBJPROP_TEXT,CharToString(233));
   ObjectSetString(ChartID(), "MAIN",OBJPROP_FONT,"WingDings");
   ObjectSetInteger(ChartID(), "MAIN",OBJPROP_FONTSIZE,15);
   ObjectSet("MAIN",OBJPROP_CORNER,CORNER_LEFT_UPPER);
   ObjectSet("MAIN",OBJPROP_XDISTANCE,270);
   ObjectSet("MAIN",OBJPROP_YDISTANCE,59);
   ObjectSet("MAIN",OBJPROP_BORDER_TYPE,BORDER_FLAT);
   ObjectSet("MAIN",OBJPROP_COLOR,clrWhite);
   ObjectSet("MAIN",OBJPROP_BGCOLOR,clrMidnightBlue);   
chiefkeef
Trader
Posts: 13
Joined: Mon Sep 07, 2020 8:09 pm

Can you make an Arrow Object In the Corner of your screen?

Post by chiefkeef »

renexxxx » Sat Nov 07, 2020 5:03 am wrote:An object of type OBJ_ARROW_UP is not a label. Instead it is positioned relative to the time and price parameters in the ObjectCreate() function.

If you want to place a label on the chart, relative to an x and y coordinate, you need to use the OBJ_LABEL object type. So, the code will look something like this:

Code: Select all

   if (ObjectFind("MAIN") >= 0) ObjectDelete("MAIN");
   ObjectCreate("MAIN",OBJ_LABEL,0,0,0);
   ObjectSetString(ChartID(), "MAIN",OBJPROP_TEXT,CharToString(233));
   ObjectSetString(ChartID(), "MAIN",OBJPROP_FONT,"WingDings");
   ObjectSetInteger(ChartID(), "MAIN",OBJPROP_FONTSIZE,15);
   ObjectSet("MAIN",OBJPROP_CORNER,CORNER_LEFT_UPPER);
   ObjectSet("MAIN",OBJPROP_XDISTANCE,270);
   ObjectSet("MAIN",OBJPROP_YDISTANCE,59);
   ObjectSet("MAIN",OBJPROP_BORDER_TYPE,BORDER_FLAT);
   ObjectSet("MAIN",OBJPROP_COLOR,clrWhite);
   ObjectSet("MAIN",OBJPROP_BGCOLOR,clrMidnightBlue);   
I see so I can only post labels .Thanks :)
Post Reply

Return to “Coders Hangout”