Indicators: BB Stops - MACD

 

BB Stops - MACD:

MACD indicator that is using very well known BB Stops instead of using signal line for signals.

You can control the % risk based for the signals (the smaller the risk %, the faster the BB Stops are reacting), but some experimenting is advised before using in real trading.

Author: Mladen Rakic

 

I think MetaTrader 5 has a big bug. When i add this indicator to my EA, it clones itself hundered times.

*****************************************************************************************************************************

//+------------------------------------------------------------------+

//|                                                                  |

//+------------------------------------------------------------------+

void tickProcess(int index)

  {


   orderClose(index);

   

   

   int bbMACDDefinition = iCustom(sympol,0,"BB stops - MACD");    //Doesnt work ! I guess MT bug.

   double macd[];

   double bmax[];

   double bmin[];

   double bblu[];

   double bbld[];

   double bba[];

   double bbc[];

   ArraySetAsSeries(macd,true);

    ArraySetAsSeries(bmax,true);

      ArraySetAsSeries(bmin,true);

         ArraySetAsSeries(bblu,true);

            ArraySetAsSeries(bbld,true);

               ArraySetAsSeries(bba,true);

                  ArraySetAsSeries(bbc,true);

   CopyBuffer(bbMACDDefinition,0,0,6,macd);

   CopyBuffer(bbMACDDefinition,1,0,6,bmax);

   CopyBuffer(bbMACDDefinition,2,0,6,bmin);

   CopyBuffer(bbMACDDefinition,3,0,6,bblu);

   CopyBuffer(bbMACDDefinition,4,0,6,bbld);

   CopyBuffer(bbMACDDefinition,5,0,6,bba);

   CopyBuffer(bbMACDDefinition,6,0,6,bbc);

   

  

   int adxDefinition=iADXWilder(sympol,0,14);    // Works well !

   double adxArray[];

   double dipArray[];

   double dinArray[];

   ArraySetAsSeries(adxArray,true);

   ArraySetAsSeries(dipArray,true);

   ArraySetAsSeries(dinArray,true);

   CopyBuffer(adxDefinition,0,0,11,adxArray);

   CopyBuffer(adxDefinition,1,0,11,dipArray);

   CopyBuffer(adxDefinition,2,0,11,dinArray);




Loop

 
cuneytates:

I think MetaTrader 5 has a big bug. When i add this indicator to my EA, it clones itself hundered times.

*****************************************************************************************************************************

//+------------------------------------------------------------------+

//|                                                                  |

//+------------------------------------------------------------------+

void tickProcess(int index)

  {


   orderClose(index);

   

   

   int bbMACDDefinition = iCustom(sympol,0,"BB stops - MACD");    //Doesnt work ! I guess MT bug.

   ...





Nothing wrong with MT5 regarding that

You are forcing (by not checking if the custom indicator is already loaded)  that multiple loading. Correct your code

 
Mladen Rakic:

Nothing wrong with MT5 regarding that

You are forcing (by not checking if the custom indicator is already loaded)  that multiple loading. Correct your code

Dear Rakic,

i am new at coding.

Please tell me where did i go wrong?

what is the mean of "multiple loading"?

Thanks

 
cuneytates:

Dear Rakic,

i am new at coding.

Please tell me where did i go wrong?

what is the mean of "multiple loading"?

Thanks

Then please post at the forum topics, not at code base

One of the possible (many) solutions to your error :

void tickProcess(int index)
{

   //...

   static int bbMACDDefinition=INVALID_HANDLE;
          if (bbMACDDefinition==INVALID_HANDLE) bbMACDDefinition = iCustom(_Symbol,_Period,"BB stops - MACD");    //Doesnt work ! I guess MT bug.
          if (bbMACDDefinition==INVALID_HANDLE) return;

   //
   // do the rest of the processing the same as you did in your code
   //
}
As of the rest : I believe that there is nothing to further explain in the "multiple loading" expression 
 
Mladen Rakic:

The please post at the forum topics, not at code base

One of the possible (many) solutions :

As of the rest : I believe that there is nothing to further explain in the "multiple loading" expression 
Thanks. I am going to post to forum.