Rectangle didn't appear on Chart

 

Hi,

I'm not Pro in coding I created a code to draw a rectange on the chart and filled with red colour 

I have 2 problems 

1. The Object is listed in Object List but not appear on the Chart except when check it's properties and click OK.

2. Want "Time 2" to be a 2 weeks back shift.

Here's the code if someone can help:

ObjectCreate(0,"Rec",OBJ_RECTANGLE,0,1,GridHigh,1,GridLow);
ObjectSetInteger(0,"Rec",OBJPROP_COLOR,clrRed);
ObjectSetInteger(0,"Rec",OBJPROP_STYLE,STYLE_SOLID);
ObjectSetInteger(0,"Rec",OBJPROP_WIDTH,2);
ObjectSetInteger(0,"Rec",OBJPROP_FILL,true);
ObjectSetInteger(0,"Rec",OBJPROP_BACK,false);
ObjectSetInteger(0,"Rec",OBJPROP_SELECTABLE,false);
ObjectSetInteger(0,"Rec",OBJPROP_SELECTED,false);
ObjectSetInteger(0,"Rec",OBJPROP_ZORDER,0);
ObjectSetInteger(0,"Rec",OBJPROP_HIDDEN,false);
ChartRedraw();

Improperly formatted code edited moderator.

Thanks in Advance

 
rack:
The Object is listed in Object List but not appear on the Chart
ObjectCreate(0,"Rec",OBJ_RECTANGLE,0,1,GridHigh,1,GridLow);

Create it with correct times, not a zero width rectangle back in 1970.

 

Improperly formatted code edited moderator. Please always use the CODE button (Alt-S) when inserting code.

Code button in editor

 
William Roeder #:

Create it with correct times, not a zero width rectangle back in 1970.

Please Help me with that

I want time 1 to be today and time 2 is 2 weeks ago

Thanks William
 
Fernando Carreiro #:

Improperly formatted code edited moderator. Please always use the CODE button (Alt-S) when inserting code.

I know this is not Professional But I write it in a custom block of fxdreema 
 
William Roeder #:

Create it with correct times, not a zero width rectangle back in 1970.

Thank you William I made it, Thanks for your help.
 
rack #: I know this is not Professional But I write it in a custom block of fxdreema 

And what does that have to do with posting the code correctly?

Also, if you are using a Code Generator then we cannot help you much with your code, because you will not be able to understand our advice or how to apply it.

Reason: