Eternal loop of indicators !

 

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

Indicators: TrendLord
Indicators: TrendLord
  • 2018.12.18
  • www.mql5.com
Articles, Library comments: Indicators: TrendLord
 
cuneytates:

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? 
 
Minions Labs:
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);


   

Adaptive Smoother
Adaptive Smoother
  • www.mql5.com
One more average/smoother that due to its fractional calculation period possibility can be used to be made adaptive. Some call it Jurik smooth some don't. Since it is not a Jurik MA left simply the name to be "smoother". The bigest difference is that this one is adaptive too unlike the similar ones that can be found floating on the net. In this...
Files:
l1.JPG  166 kb
l2.JPG  172 kb
 
cuneytates:

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()??
 
Minions Labs:
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.