Expert Advisors: EA_OBJPROP_CHART_ID

 

EA_OBJPROP_CHART_ID:

Do you want to place a Chart objects (OBJ_CHART) on the chart and use it as conventional chart? It's possible.

This Expert Advisor is a demo of working with OBJ_CHART objects as conventional charts. You can set custom color settings, attach indicators etc. The only thing you need is the handle of OBJ_CHART object. Using the Chart Operations you may add and delete indicators (ChartIndicatorAdd() and ChartIndicatorDelete()), set chart Period, Symbol etc.

The EA_OBJPROP_CHART_ID Expert Advisor, does the following actions:

  • Adds a PriceChannel indicator, included in the standard package of the client terminal (located in terminal_data_folder\MQL5\Indicators\Examples);
  • Creates a subwindow using Subwindow indicator (copy Subwindow.mq5 to terminal_data_folder\MQL5\Indicators);
  • Creates an object (in the subwindow) of OBJ_CHART type with chart symbol, but D1 and H4 timeframes;
  • For each object of OBJ_CHART type it adds a Price_Channel indicator with default parameters and changes background color.

    EA_OBJPROP_CHART_ID

Author: MetaQuotes


 
And how do I assign other buffer colours when adding an indicator?
 
sergeev:
but is it technically possible? Should I write a request to servicedesk (not for "ticking the box")?

I'm sure that from a technical point of view it is possible, because in fact it is already implemented, you just need to add new parameters to the language.

 


Rosh
, it seems to me that there are already a lot of requests concerning the expansion of the functionality of working with indicators.

At the moment we have only 4 functions of working with indicators programmatically:

In the request to servicedesk #98320 | 2011.05.08 19:13 suggested an additional function:
ChartIndicatorFileName - which returns the name of the indicator file

The request for extended work with indicators has also appeared long ago (in the dreams of users :):
ChartIndicatorSetDouble, ChartIndicatorSetInteger, ChartIndicatorSetString - full analogues of the functions of custom indicators IndicatorSetDouble , IndicatorSetInteger, IndicatorSetString , but only the reference is to a specific indicator on the chart.


 
sergeev:
but is it technically possible? Is it worth writing a request to servicedesk (not for "ticking the box")?

The ChartIndicatorAdd() function operates the indicator handle, i.e. the calculation part. The indicator handle can be used repeatedly and simultaneously, and it knows nothing about what specific chart its data is displayed on and how it looks visually. Only the indicator itself, which is thrown on the chart, knows this.

That is, at the moment, there are no ready-made possibilities in MQL5 language to manage the visual properties of an indicator thrown on a chart. There are no strings to pull.

 

ok. tell me why the ChartSaveTemplate function does not save templates from the "Chart" object ?

although ChartApplyTemplate for the "Chart" object works fine!

 
sergeev:

ok. tell me why the ChartSaveTemplate function does not save templates from the "Chart" object ?

This is an unexpected question, because such a possibility was not initially considered.
 

I recently asked a similar question about different colours here : MAs. I set them to the periods I needed.

And hence the question: where in Alligator are the colours of the lines (displayed buffers) set? Is it possible to access it in some way?

Then I could write my own indicator with the required colouring by analogy.

OBJ_CHART
OBJ_CHART
  • www.mql5.com
С помощью данного кода можно создать объект OBJ_CHART и прикрепить к нему разные индикаторы, например, четыре МА:.
 
falkov:

And hence the question: where in Alligator are the colours of the lines (displayed buffers) set? Is it possible to access it in some way?

Then it would be possible to write your own indicator with the required colouring by analogy.

When using the ChartIndicatorAdd() function, the indicator is overlaid on the chart with default colours. This cannot be controlled (directly).

Theoretically, it is possible to put the line colour into an external variable of the custom indicator and thus set the desired colour.

 
Rosh:
that possibility wasn't originally considered.

MetaTrader 5 Client Terminal build 468

MQL5: Fixed ChartSaveTemplate function.

Thank you very much! Everything works.

 

Rosh, on request #98320, can you add the name of the physical file to the indicator handler object ?

I.e. so that you can find out not only the short name of the indicator, but also its full file name?

ChartIndicatorFileName

Возвращает имя файла индикатора по номеру в списке индикаторов на указанном окна графика.

string  ChartIndicatorFileName(
   long  chart_id,      // chart identifier
   int   sub_window     // subwindow number
   int   index          // indicator index in the list of indicators added to this chart subwindow
   );