Download MetaTrader 5

Draawing Rectangle or Vertical Lines on chart now showing in desired color

To add comments, please log in or register
1000 paid orders are executed in Freelance service. Sign up!
Abhay Agarwal
168
Abhay Agarwal 2015.09.29 03:09 

I am trying to draw vertical lines or a single line rectangle at any given bar and I want to display different colors for different conditions. But all vertical line or rectangle is appearing in single color i.e Blue.


The code used to draaw is below, can anyone suggest why it is not showing desired color


   if (!ObjectCreate(0,"TP"+seq,OBJ_RECTANGLE,0,StrToTime(from_chart_time),0,Time[limit-bar+1],2))
   {
      ObjectDelete(0,"TP");
     
      ObjectCreate(0,"TP",OBJ_RECTANGLE,0,StrToTime(from_chart_time),0,Time[limit-bar+1],1000);

      ObjectSetInteger(0,"TP",OBJPROP_FILL,true);
      ObjectSetInteger(0,"TP",OBJPROP_COLOR,clrYellow); 
        ObjectSetInteger(0,"TP",OBJPROP_STYLE,STYLE_SOLID);
        ObjectSetInteger(0,"TP",OBJPROP_WIDTH,2);
        ObjectSetInteger(0,"TP",OBJPROP_BACK,true);

   }
   else
   {
      ObjectSetInteger(0,"TP"+seq+bar_label,OBJPROP_FILL,true);
      ObjectSetInteger(0,"TP"+seq+bar_label,OBJPROP_COLOR,clrYellow);
      ObjectSetInteger(0,"TP"+seq+bar_label,OBJPROP_STYLE,STYLE_DASH);
      ObjectSetInteger(0,"TP"+seq+bar_label,OBJPROP_WIDTH,2);
   }

Files:
Draw_Bars.gif 24 kb
Vladimir Karputov
Moderator
45665
Vladimir Karputov 2015.09.29 09:23  
Update: the chart must always be one rectangle and one vertical line?
To add comments, please log in or register