Download MetaTrader 5

invalid integer number

To add comments, please log in or register
Rinor Memeti
2789
Rinor Memeti  

Hey Community.

 

I searched with google about this problem but i didnt find a soultion :/ The problem is that i get the following problem on my own created indicator: "test DE30.Z,M15: invalid integer number as parameter 2 for 'iCustom' function"

Im using the following code. Would be very nice if you could help me because im just a beginner :/:P

 

Code:

 #property copyright "Your copyright"

#property link "Link to your website"

#property indicator_chart_window

#property indicator_buffers 2

#property indicator_color1 Green

#property indicator_width1 2

#property indicator_color2 Red

#property indicator_width2 2

// exported variables

// local variables

string LF = "\n";  // use this in custom or utility blocks where you need line feeds

int ObjCount = 0;  // count of all objects created on the chart, allows creation of objects with unique names

int current = 0; // variable points to current bar

double Buffer11[];

double Buffer5[];

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

//| Custom indicator initialization function                         |

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

int init()

{

    if (true) ObjectsDeleteAll();      // clear the chart

    IndicatorShortName("Indicator name");

    IndicatorDigits(0);

    IndicatorBuffers(2);

    

    SetIndexBuffer(0, Buffer11);

    SetIndexStyle(0, DRAW_LINE, STYLE_DASH);

    

    SetIndexBuffer(1, Buffer5);

    SetIndexStyle(1, DRAW_LINE, STYLE_SOLID);

    

    

    return(0);

}

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

//| Custom indicator deinitialization function                       |

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

int deinit()

{

    if (true) ObjectsDeleteAll();

    

    

    return(0);

}

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

//| Custom indicator start function                                  |

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

int start()

{

    OnEveryTick3();

    

    return(0);

}

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

void OnEveryTick3()

{

    

    int i;

    int counted_bars = IndicatorCounted();

    if(counted_bars < 0) return(-1);

    if(counted_bars > 0) counted_bars--;

    i = Bars - counted_bars;

    // main calculation loop

    while (i >= 0)

    {

        current = i;

        TechnicalAnalysis2x8();

        TechnicalAnalysis2x7();

        

        i--;

    }

}

void TechnicalAnalysis2x8()

{

    if ((iCustom(NULL, NULL, "testindicator",40,0,0) > iCustom(NULL, NULL, "testindicator",40,1,0)) && (iCustom(NULL, NULL, "testindicator",40,1,1) < iCustom(NULL, NULL, "testindicator",40,0,1)))

    {

        ChartLine11();

        

    }

}

void ChartLine11()

{

    Buffer11[current]= Ask;

    

}

void TechnicalAnalysis2x7()

{

    if ((iCustom(NULL, NULL, "testindicator",40,1,0) > iCustom(NULL, NULL, "testindicator",40,0,0)) && (iCustom(NULL, NULL, "testindicator",40,0,1) > iCustom(NULL, NULL, "testindicator",40,1,1)))

    {

        ChartLine5();

        

    }

}

void ChartLine5()

{

    Buffer5[current]= Ask;

    

}
Alain Verleyen
Moderator
33626
Alain Verleyen  

Forum on trading, automated trading systems and testing trading strategies


Hello,

Please use the SRC button when you post code. Thank you.


This time, I edited it for you.


Alain Verleyen
Moderator
33626
Alain Verleyen  
wienerschinken:

Hey Community.

 

I searched with google about this problem but i didnt find a soultion :/ The problem is that i get the following problem on my own created indicator: "test DE30.Z,M15: invalid integer number as parameter 2 for 'iCustom' function"

Im using the following code. Would be very nice if you could help me because im just a beginner :/:P

 

Code:

Second parameter should be 0 and not NULL.
Rinor Memeti
2789
Rinor Memeti  
You are a genius :)))) Many thanks :))))
To add comments, please log in or register