Create Rectangle in Indicator Window over Coordinate System

 

Hello Everybody,

i'm trying to set rectangles in an Indicator Window. It seems that you can only use time as X-Coordinate. Thats why i wrote a function that calculates a wanted coordinate value into a time value at the horizontal time line displayed in the Indicator Window. That works great, but if there is a weekend in the visible chart time, x-values are not correctly calculated in time as there are gaps of no values during the weekend days.

Ist there a good way to draw stuff into the indicator window with nice values like pixels or something else?

thanks for you help!

jacob

Here is my simple code:

double     xFragments = 1000;

int xCoor(int x){
   int firstBar = WindowBarsPerChart() - 2;
   
   datetime Start = Time[firstBar];       // Defining 1st time coord.
   datetime End = Time[0];
   double Spread;
   double xUnit;
   Spread = End - Start;
   
   xUnit = Spread/xFragments;
   
   return (Start + MathCeil(xUnit*x));
}
 
I think if you combine This with This you might be able to create what you're looking for.
 

Thank you for your answer,

the link you sent me is nice, alsthought the rectangles do not scale with the height of the window, however i've written code that analyses gaps in the market data and scales down an linear x value to the timeline regardless of missing market data ...

not totally finished yet. but works well.

Jacob