[HELP-Answered] Draw same object on multiple charts

 

Hi all

I am trying to draw a square from time1,price1 to time2,price2 across all open charts.

I expected this to work but it only draws it on the first chart.

long chartID=0;
if(drawFVG) while(chartID >= 0)
  {
   RectangleCreate(chartID,"FVG"+par_temp,0,time1,price1,time2,price2);
   printf("ChartID:"+chartID);
   chartID = ChartNext(chartID);

  } 

In particular, my main timeframe chart is the 15 min, and I will have open other charts of other timeframes.

I want this to be drawn across the board on all charts but it prints chartID:0, ChartID: 12345, and nothing else, while I have about 6 charts open both on ST and real market.

My idea is that the iTime will be the same time on all charts, and the price will also be the same on all charts, so should draw it just fine.

My problem is the cycling of the charts. This is my first time trying to draw on more than the front chart (chart ID 0).

Thank you

Nuno


EDIT: I read on another post that there might be a difference in the strategy tester and real market when it comes to drawing. I would like it to draw on both real market and strategy tester.

Documentation on MQL5: Chart Operations / ChartFirst
Documentation on MQL5: Chart Operations / ChartFirst
  • www.mql5.com
ChartFirst - Chart Operations - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 

This is well mql5 ? 

You can't draw at all on other charts with the Strategy Tester, only on the main one.

 
Alain Verleyen #:

This is well mql5 ? 

You can't draw at all on other charts with the Strategy Tester, only on the main one.

OK, thank you.

 
Nuno Madeira Amaro Pire Costa: I expected this to work but it only draws it on the first chart.
Start by getting the first chart ID. Zero is not.