Can we apply template to Added Chart Object (OBJ_CHART)

To add comments, please log in or register
MEHMET FATIH BARUT
236
MEHMET FATIH BARUT  

Hi all,

Can we apply template to Added Chart Object (OBJ_CHART)

Alain Verleyen
39091
Alain Verleyen  

Yes.

Forum on trading, automated trading systems and testing trading strategies

Adding Indicators to the mini charts in MT5

Alain Verleyen, 2013.12.01 17:41

I made an example to demonstrate this, see this chart :

I added a chart object named "MiniChart", then I run the following code :

   //--- Get mini chart ID
   long miniChartID=ObjectGetInteger(0,"MiniChart",OBJPROP_CHART_ID);
   //--- Get inficator handle
   int maHandle=iMA("EURCHF",PERIOD_H1,12,0,MODE_SMA,PRICE_CLOSE);   
   //--- Add indicator ro mini chart
   if(miniChartID>0 && maHandle!=INVALID_HANDLE)
      ChartIndicatorAdd(miniChartID,0,maHandle);
Of course, the chart object can also be added by code if needed.

Instead of ChartIndicatorAdd(), use ChartApplyTemplate().
MEHMET FATIH BARUT
236
MEHMET FATIH BARUT  
Cool I will try it.
To add comments, please log in or register