Download MetaTrader 5
To add comments, please log in or register
Install apps from the library right in MetaTrader. It is easy!
Bryan McAfee
970
Bryan McAfee 2013.12.01 16:04 

I was wondering if it is possible to add indicators to the mini charts that are available in MT5.  I Googled it and came up blank.  

 Pic below.

http://i.imgur.com/V8nKd5r.png

Alain Verleyen
Moderator
29640
Alain Verleyen 2013.12.01 17:26  
Yes it's possible but only by programming.
Alain Verleyen
Moderator
29640
Alain Verleyen 2013.12.01 17:41  

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

MetaTrader Trading Platform Screenshots

GBPCHF, D1, 2013.12.01

MetaQuotes Software Corp., MetaTrader 5, Demo

Example of a mini chart (object) with an indicator added

GBPCHF, D1, 2013.12.01, MetaQuotes Software Corp., MetaTrader 5, Demo

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.
Bryan McAfee
970
Bryan McAfee 2013.12.01 18:23  
Thank you so much !!!
Innate
10
Innate 2014.10.16 04:34  

Sorry for such a noob question but how do you execute the above code? 

I can add a new mini chart via the drop down menu's (Insert/Objects/Graphical/Chart)

But I dont understand how to run the code to get the indicator appear.

 

Thank you.  

Alain Verleyen
Moderator
29640
Alain Verleyen 2014.10.16 08:57  
Innate:

Sorry for such a noob question but how do you execute the above code? 

I can add a new mini chart via the drop down menu's (Insert/Objects/Graphical/Chart)

But I dont understand how to run the code to get the indicator appear.

 

Thank you.  

Create a new script for example and copy and paste this code inside OnStart() function.
Innate
10
Innate 2014.10.17 00:24  
angevoyageur:
Create a new script for example and copy and paste this code inside OnStart() function.
Thank you for such a speedy reply. I should be able to get that sorted. Much appreciated!! 
/
To add comments, please log in or register