can I place 2 or more experts on the chart?
No, just one expert at a chart/
Is this not a huge oversight.
Previously you could add multiple indicators that place objects on the charts. But now we cannot place objects on charts unless its via an expert or script, both of which you can only add one.
This is now a huge limitation so what is the proposed work arround?
Is this not a huge oversight.
Previously you could add multiple indicators that place objects on the charts. But now we cannot place objects on charts unless its via an expert or script, both of which you can only add one.
This is now a huge limitation so what is the proposed work arround?
At the moment indicator can create the graphical objects, try this one:
//+------------------------------------------------------------------+
//| testObjectsInIndicator.mq5 |
//| Copyright 2009, MetaQuotes Software Corp. |
//| http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "2009, MetaQuotes Software Corp."
#property link "http://www.mql5.com"
#property version "1.00"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_plots 1
//---- plot Bollinger
#property indicator_label1 "BB High; BB Low"
#property indicator_type1 DRAW_FILLING
#property indicator_color1 Magenta,LimeGreen
#property indicator_style1 STYLE_SOLID
#property indicator_width1 1
//--- input parameters
input int BBperiod=20; // период BBands
input int length=30; // длина канала
input double width=2.0; // ширина BBands
input color channelColor=Turquoise; // цвет канала
//--- indicator buffers
double BollingerBuffer1[];
double BollingerBuffer2[];
int handleBBands;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- indicator buffers mapping
SetIndexBuffer(0,BollingerBuffer1,INDICATOR_DATA);
SetIndexBuffer(1,BollingerBuffer2,INDICATOR_DATA);
handleBBands=iBands(NULL,0,BBperiod,0,width,PRICE_CLOSE);
//---
Print("Function ",__FUNCTION__," Build ",__MQ5BUILD__);
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
//---
static int prevbars=-1;
//int bars=Bars(NULL,0);
int copied=CopyBuffer(handleBBands,1,0,rates_total,BollingerBuffer1);
if(copied<=0)
{
Print("Не удалось скопировать значения индикатора");
return(0);
}
copied=CopyBuffer(handleBBands,2,0,rates_total,BollingerBuffer2);
if(copied<=0)
{
Print("Не удалось скопировать значения индикатора");
return(0);
}
if(prevbars!=rates_total)
{
prevbars=rates_total;
ArraySetAsSeries(time,true);
SetupChannel(time[length],time[1]);
}
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void SetupChannel(datetime time1,datetime time2)
{
static string channelName="Channel";
static string startLine="start";
static string finishLine="finish";
if(ObjectFind(0,channelName)<0)
{
Print("The channel is not found, create ourselves");
if(!ObjectCreate(0,channelName,OBJ_STDDEVCHANNEL,0,0,0))
Print("Channel creating failed, error =",GetLastError());
else
{
ObjectSetInteger(0,channelName,OBJPROP_COLOR,channelColor);
Print("Set the channel beginning at",time1);
ObjectSetInteger(0,channelName,OBJPROP_TIME,0,time1);
Print("Set the channel ending at",time2);
bool modified=ObjectSetInteger(0,channelName,OBJPROP_TIME,1,time2);
if(!modified)
{
Print("Channel Time coordinates setting failed. Error",GetLastError());
}
Print("Set channel at background");
ObjectSetInteger(0,channelName,OBJPROP_BACK,true);
}
}
if(ObjectFind(0,startLine)<0)
{
Print("The Start line not found, try to create myself");
if(!ObjectCreate(0,startLine,OBJ_VLINE,0,time1,0))
Print("Failed to create a line startline, error =",GetLastError());
}
if(ObjectFind(0,finishLine)<0)
{
Print("The Finish line not found, try to create myself");
if(!ObjectCreate(0,finishLine,OBJ_VLINE,0,time2,0))
Print("Failed to create a line finishline, error =",GetLastError());
}
}
//+------------------------------------------------------------------+
At the moment indicator can create the graphical objects, try this one:
I hope. If new troubles don't appear cause of that it will support.
You can open a currency window more than one times.
So I would put Indicator1 on window 1, Indicator 2 on window 2 and so on.
I don't know if Indicator 1 can uses values of Indicator 2, because I never needed it / testet it.
So you could see, which Indicator works best.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
because my indicaotor cannot draw object under MT5, so I change to expert, so can I place 2 or more experts on the chart?
thanks
hongbin.fei