Hi guys,
When i wanted to add custom indicator to EA and test it, it creates or clone itself hundered times. It happens more then 5 indicators.
Please check my post and help me for solution.
Thanks.
https://www.mql5.com/en/forum/295383#comment_9979501
Your code is incomplete, where are you putting the indicator?
Thanks for your reply.
Nothing wrong with my EA. It works well with MetaTraders defaults like iMA, iBollinger etc and also some custom indicators.
****** For example i call the indicator where is https://www.mql5.com/en/code/16802 and add that code to my EA it works without anyproblem and when i test it it creates only one line and doest repeat itself.
int ssaDefinition = iCustom(sympol,0,"Smoother_std_adaptive");
double ssaFiyat[];
double ssmColor[];
ArraySetAsSeries(ssaFiyat,true);
ArraySetAsSeries(ssmColor,true);
CopyBuffer(ssaDefinition,0,0,6,ssaFiyat);
CopyBuffer(ssaDefinition,1,0,6,ssmColor);
Another good sample:
int linearDefinition = iCustom(sympol,0, "Linear regression");
double linear[];
double linearColor[];
ArraySetAsSeries(linear,true);
ArraySetAsSeries(linearColor,true);
CopyBuffer(linearDefinition,0,0,6,linear);
CopyBuffer(linearDefinition,1,0,6,linearColor);
****** But when i add these indicators, they starts to looping while my EA's backtest:
https://www.mql5.com/en/code/23496:
int ssmRsiDefinition = iCustom(sympol,0, "Ssm RSI");
double ssmRsi[];
double ssmRsiColor[];
ArraySetAsSeries(ssmRsi,true);
ArraySetAsSeries(ssmRsiColor,true);
CopyBuffer(ssmRsiDefinition,0,0,6,ssmRsi);
CopyBuffer(ssmRsiDefinition,1,0,6,ssmRsiColor);
https://www.mql5.com/en/code/22515
int trendLord = iCustom(sympol,0,"TrendLord");
double trendTrend[];
double trendColor[];
double trendMA[];
ArraySetAsSeries(trendTrend,true);
ArraySetAsSeries(trendColor,true);
ArraySetAsSeries(trendMA,true);
CopyBuffer(trendLord,0,0,6,trendTrend);
CopyBuffer(trendLord,1,0,6,trendColor);
CopyBuffer(trendLord,2,0,6,trendMA);
- www.mql5.com
Thanks for your reply.
Nothing wrong with my EA. It works well with MetaTraders defaults like iMA, iBollinger etc and also some custom indicators.
****** For example i call the indicator where is https://www.mql5.com/en/code/16802 and add that code to my EA it works without anyproblem and when i test it it creates only one line and doest repeat itself.
int ssaDefinition = iCustom(sympol,0,"Smoother_std_adaptive");
double ssaFiyat[];
double ssmColor[];
ArraySetAsSeries(ssaFiyat,true);
ArraySetAsSeries(ssmColor,true);
CopyBuffer(ssaDefinition,0,0,6,ssaFiyat);
CopyBuffer(ssaDefinition,1,0,6,ssmColor);
Another good sample:
int linearDefinition = iCustom(sympol,0, "Linear regression");
double linear[];
double linearColor[];
ArraySetAsSeries(linear,true);
ArraySetAsSeries(linearColor,true);
CopyBuffer(linearDefinition,0,0,6,linear);
CopyBuffer(linearDefinition,1,0,6,linearColor);
****** But when i add these indicators, they starts to looping while my EA's backtest:
https://www.mql5.com/en/code/23496:
int ssmRsiDefinition = iCustom(sympol,0, "Ssm RSI");
double ssmRsi[];
double ssmRsiColor[];
ArraySetAsSeries(ssmRsi,true);
ArraySetAsSeries(ssmRsiColor,true);
CopyBuffer(ssmRsiDefinition,0,0,6,ssmRsi);
CopyBuffer(ssmRsiDefinition,1,0,6,ssmRsiColor);
https://www.mql5.com/en/code/22515
int trendLord = iCustom(sympol,0,"TrendLord");
double trendTrend[];
double trendColor[];
double trendMA[];
ArraySetAsSeries(trendTrend,true);
ArraySetAsSeries(trendColor,true);
ArraySetAsSeries(trendMA,true);
CopyBuffer(trendLord,0,0,6,trendTrend);
CopyBuffer(trendLord,1,0,6,trendColor);
CopyBuffer(trendLord,2,0,6,trendMA);
I mean in which function of your EA are you putting the iCustom call ?? OnInit()? OnTick()??
I add all default and custom indicators like here:
..........
void OnTick()
{
if(run_for_all_symbols)
{
for(int i=0;i<SymbolsTotal(true);i++)
{
sympol=SymbolName(i,true);
checkTimeControlAndProcess(i);
}
} else {
sympol=Symbol();
checkTimeControlAndProcess(0);
}
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
void tickProcess(int index)
{
orderClose(index);
int trendLord = iCustom(sympol,0,"TrendLord");
double trendTrend[];
double trendColor[];
double trendMA[];
ArraySetAsSeries(trendTrend,true);
ArraySetAsSeries(trendColor,true);
ArraySetAsSeries(trendMA,true);
CopyBuffer(trendLord,0,0,6,trendTrend);
CopyBuffer(trendLord,1,0,6,trendColor);
CopyBuffer(trendLord,2,0,6,trendMA);
Problem solved.
MT5 has no bug, i am the bug :)
I moved to indicator adress to OnInit section.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi guys,
When i wanted to add custom indicator to EA and test it, it creates or clone itself hundered times. It happens more then 5 indicators.
Please check my post and help me for solution.
Thanks.
https://www.mql5.com/en/forum/295383#comment_9979501