draw rectangle each minute on M30 candles

 

Hi

I have bars M30. I want to draw a rectangle on each minute of this bar. As start I want to draw bid prices using rectangle. 

My code:

MqlRates prices[];
datetime lastTime = 0;
double lastBid;
int toCopy = 3;
void OnTick()
  {
   if(CopyRates(Symbol(), Period(), 0, toCopy, prices) == toCopy)
     {
      double bid = NormalizeDouble(SymbolInfoDouble(_Symbol, SYMBOL_BID), _Digits);
      datetime currentTime = TimeCurrent();
      if(lastTime != 0)
        {
         string name = "bid" + nameCounter;
         ObjectCreate(0, name, OBJ_RECTANGLE, 0, lastTime, bid, currentTime, bid);
         ObjectSetInteger(0, name, OBJPROP_COLOR, clrRed);
         nameCounter++;
        }
      lastTime = currentTime;
      lastBid = bid;
      //Print("currentTime=", currentTime, " bid=", bid);
     }
  }

The result is in attachment.

Which means I can't draw rectangle (or other object) with resolution 1 minute.

How to set possibility do draw an object each minute without changing candle length?

Files:
1.png  3 kb
 
pkoral:

Hi

I have bars M30. I want to draw a rectangle on each minute of this bar. As start I want to draw bid prices using rectangle. 

My code:

The result is in attachment.

Which means I can't draw rectangle (or other object) with resolution 1 minute.

How to set possibility do draw an object each minute without changing candle length?

The bar already represents the bid prices
 
Paul Anscombe #:
The bar already represents the bid prices
How is that? During M30 bid price can change dramatically. And bar (candle) has OHLC prices (4 prices).
 
pkoral:

Hi

I have bars M30. I want to draw a rectangle on each minute of this bar. As start I want to draw bid prices using rectangle. 

My code:

The result is in attachment.

Which means I can't draw rectangle (or other object) with resolution 1 minute.

How to set possibility do draw an object each minute without changing candle length?

1. There is nothing related to 1 minute in your code, it's executed each tick.

2. You need to set your terminal chart setting.


 
pkoral #:
How is that? During M30 bid price can change dramatically. And bar (candle) has OHLC prices (4 prices).
So what you want to create 1 minute bars ? Just use the 1 minute chart
And if you’re are trying to display just 1 m1 bar then all you have achieved is an extra 4 prices OHLC of the minute it’s not clear what you are trying to do
Reason: