Coding help - page 776

To add comments, please log in or register
sathish kumar
4676
sathish kumar  

hai,


pls add sound alert,message alert and mobile notification option for this indicator.

thanks

Files:
dvetri
70
dvetri  

Hi

I found the topics like "iCustom returns wrong values" but this is little bit different.

I try to create indicator which compares size of identical type of bars (bull/bear type) in a sequence.

and shows maximum values of comparison in histogram.

like this.

max_value

//-----------------------------

with ArrayMaximum the result is more faster. but there is something wrong with my code.example:

iCustom_diff

here is the code which compares iCustom values and returns wrong values:

#property indicator_separate_window
#property indicator_buffers 4


#property indicator_color1 DeepSkyBlue
#property indicator_width1 10


#property indicator_color2 Red
#property indicator_width2 10



#property indicator_color3 DodgerBlue
#property indicator_width3 4


#property indicator_color4 Crimson
#property indicator_width4 4


#property indicator_level1 0
#property indicator_levelcolor White
#property indicator_levelstyle 0


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 Buffer1[];
double Buffer2[];

double Buffer3[];
double Buffer4[];


double bar_0;
double bar_1;
double bar_2;
double bar_3;
double bar_4;
double bar_5;
double bar_6;
double bar_7;
double bar_8;
double bar_9;
double bar_10;
double bar_11;


//+------------------------------------------------------------------+
int init()
{
    if (false) ObjectsDeleteAll();      // clear the chart

    IndicatorDigits(Digits-5);
    IndicatorBuffers(4);
    
    SetIndexBuffer(0, Buffer1);
    SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID);
    
    SetIndexBuffer(1, Buffer2);
    SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID);
    
    
    
    
    SetIndexBuffer(2, Buffer3);
    SetIndexStyle(2, DRAW_HISTOGRAM, STYLE_SOLID);
    
    SetIndexBuffer(3, Buffer4);
    SetIndexStyle(3, DRAW_HISTOGRAM, STYLE_SOLID);
    
    
    return(0);
}


//+------------------------------------------------------------------+
int deinit()
{
if (false) ObjectsDeleteAll();

return(0);
}


//+------------------------------------------------------------------+
int start()
{
OnEveryTick1();

return(0);
}
//+------------------------------------------------------------------+
void OnEveryTick1()
{
    
    int i;
    int counted_bars = IndicatorCounted();
    if(counted_bars < 0) return(-1);
    if(counted_bars > 0) counted_bars--;
    i = Bars - counted_bars - 1;
    // main calculation loop
    while (i >= 0)
    
{
current = i;
        
//current  >0
//current+1=0
TechnicalAnalysis00();

//current  >0
//current+1>0
//current+2=0
TechnicalAnalysis01();

//current  >0
//current+1>0
//current+2>0
//current+3=0
TechnicalAnalysis02();


i--;
}
}

//-----------------------------------------------------
//---------bar_0-------------------------------
//-----------------------------------------------------
void TechnicalAnalysis00()
{

bar_0 = iCustom(NULL, NULL, "candles_from_chart-celi_masivi",0,current);
bar_1 = iCustom(NULL, NULL, "candles_from_chart-celi_masivi",0,current+1);

if
(
bar_0 > 0
&&
bar_1 == 0
)

{
Histogram00();
}

}

void Histogram00()
{
Buffer1[current]= bar_0;
}
//-----------------------------------------------------
//---------bar_1-------------------------------
//-----------------------------------------------------
void TechnicalAnalysis01()
{

bar_0 = iCustom(NULL, NULL, "candles_from_chart-celi_masivi",0,current);
bar_1 = iCustom(NULL, NULL, "candles_from_chart-celi_masivi",0,current+1);
bar_2 = iCustom(NULL, NULL, "candles_from_chart-celi_masivi",0,current+2);

if
(
bar_0 > 0
&&
bar_1 > 0
&&
bar_2 == 0
)

{
Histogram01();
}

}

void Histogram01()
{
int x_up_01[] = {0,0};

x_up_01[0] = bar_0;
x_up_01[1] = bar_1;

int maxValue_01 = ArrayMaximum(x_up_01);

Buffer1[current]= x_up_01[maxValue_01];
}
//-----------------------------------------------------
//---------bar_2-------------------------------
//-----------------------------------------------------
void TechnicalAnalysis02()
{

bar_0 = iCustom(NULL, NULL, "candles_from_chart-celi_masivi",0,current);
bar_1 = iCustom(NULL, NULL, "candles_from_chart-celi_masivi",0,current+1);
bar_2 = iCustom(NULL, NULL, "candles_from_chart-celi_masivi",0,current+2);
bar_3 = iCustom(NULL, NULL, "candles_from_chart-celi_masivi",0,current+3);

if
(
bar_0 > 0
&&
bar_1 > 0
&&
bar_2 > 0
&&
bar_3 == 0
)

{
Histogram02();
}

}

void Histogram02()
{
int x_up_02[] = {0,0,0};

x_up_02[0] = bar_0;
x_up_02[1] = bar_1;
x_up_02[2] = bar_2;

int maxValue_02 = ArrayMaximum(x_up_02);

Buffer1[current]= x_up_02[maxValue_02];
}
//-----------------------------------------------------
//---------bar_3--------and so on-----------------------
//-----------------------------------------------------

where is my mistake? how can I fix it?
I tried to call iCustom with all extern param.  - same wrong result. I tried with no extern param. iCustom - same wrong result. 

thanks for help

main code (first histogram) and second code (second histogram) based on it :

Mkurugenzi
75
Mkurugenzi  

Hi Guys!

can someone have a working version for this attached indicators or probably can code them to be able to work with the mt4 version  4.0 build 1170.


thanks in advance 

Naguisa Unada
392
Naguisa Unada  
Mkurugenzi:

Hi Guys!

can someone have a working version for this attached indicators or probably can code them to be able to work with the mt4 version  4.0 build 1170.

Mkurugenzi
75
Mkurugenzi  
Naguisa Unada:

Hi Naguisa!


I trust your well?


I want to appreciate yiour kind gesture and effort in heeding to my humble request i had made an the 3 inicators are wqorking well. 


If you dont mind me making another humble request, would you be gracious enough to look into this other 3 indicators am attcahing here and see if you enable it work with mt4 latest build since there neither attaching nor working.

Many thanks in advance.

Naguisa Unada
392
Naguisa Unada  
Mkurugenzi:

If you dont mind me making another humble request, would you be gracious enough to look into this other 3 indicators am attcahing here and see if you enable it work with mt4 latest build since there neither attaching nor working.

Many thanks in advance.

Mkurugenzi
75
Mkurugenzi  
Naguisa Unada:

Hi Naguisa!


thanks for your help, i appreciate.

But do kindly check both cumulative delta indicators for they seem not to show anything, there just blank.

are they working from your end if i may ask, kindly?

Naguisa Unada
392
Naguisa Unada  
Mkurugenzi:

But do kindly check both cumulative delta indicators for they seem not to show anything, there just blank.

are they working from your end if i may ask, kindly?

It displays only from the present time to the future. Confirm it with the 1-minute time frame.

Mkurugenzi
75
Mkurugenzi  
Naguisa Unada:

It displays only from the present time to the future. Confirm it with the 1-minute time frame.

okay, thanks alot.

Mkurugenzi
75
Mkurugenzi  

@Naguisa Unada


I trust your well?

Kindly, would you be in a postion to look at this indicator and make it work for current mt4 build.

Actually, i got it from this forum but it seems its not working at all.

attached is the indicator and your generosity o this is appreciated in advance.

Regards.

Files:
To add comments, please log in or register