ICustom function - page 9

 

Look this is what i did (in Bold):

value1[pos]=iCustom(NULL,0,"COGpoint1",50,3000,0,true,pos,0);

value2[pos]=iCustom(NULL,0,"COGpoint1",50,3000,0,true,pos,1);

value3[pos]=iCustom(NULL,0,"COGpoint1",50,3000,0,true,pos,2);

value4[pos]=iCustom(NULL,0,"COGpoint1",50,3000,0,true,pos,3);

 

In fact, look at my code now!

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

//| COG call.mq4 |

//| |

//| |

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

#property indicator_separate_window

#property indicator_buffers 4

#property indicator_color1 Lime

#property indicator_color2 Red

#property indicator_color3 CLR_NONE

#property indicator_color4 CLR_NONE

//---- buffers

double value1[];

double value2[];

double value3[];

double value4[];

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

//| Custom indicator initialization function |

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

int init()

{

string short_name;

//---- indicators

IndicatorBuffers(4);

SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1,Lime);

SetIndexBuffer(0,value1);

SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1,Red);

SetIndexBuffer(1,value2);

SetIndexStyle(2,DRAW_NONE);

SetIndexBuffer(2,value3);

SetIndexStyle(3,DRAW_NONE);

SetIndexBuffer(3,value4);

IndicatorDigits(Digits+2);

return(0);

}

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

//| Custom indicator deinitialization function |

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

int deinit()

{

//----

//----

return(0);

}

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

//| Custom indicator iteration function |

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

int start()

{

int counted_bars=IndicatorCounted();

//---- check for possible errors

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

//---- last counted bar will be recounted

if (counted_bars>0) counted_bars--;

int pos=Bars-counted_bars;

while(pos>=0)

{

value1[pos]=iCustom(NULL,0,"COGpoint1",50,3000,0,true,pos,0);

value2[pos]=iCustom(NULL,0,"COGpoint1",50,3000,0,true,pos,1);

value3[pos]=iCustom(NULL,0,"COGpoint1",50,3000,0,true,pos,2);

value4[pos]=iCustom(NULL,0,"COGpoint1",50,3000,0,true,pos,3);

pos--;

}

return(0);

}

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

 

i tryed putting

value1[pos]=iCustom(NULL,0,"COGpoint1",50,3000,0,true,pos,0,0);

value2[pos]=iCustom(NULL,0,"COGpoint1",50,3000,0,true,pos,0,1);

value3[pos]=iCustom(NULL,0,"COGpoint1",50,3000,0,true,pos,0,2);

value4[pos]=iCustom(NULL,0,"COGpoint1",50,3000,0,true,pos,0,3);

now it has kept again only the red line wich is buffer 2 but it has now put higher up in the chart screen and it it still flat. crazy!?!?

 

ahhhhh!!!

whats so special about buffer 2???

 

I got icustom working, this thread helped alot. Im working on an EA but im learning as im doing it so its a lil slow. Is there a way stop the EA after one trade or even autoclose itself after entering one trade?

The problem is after it hits my take profit, if everything still points short, it re-enters.

Any help would be greatly appreciated....

 

A code sample, please

Could someone share a sample code of an indicator that would take the values of two custom indicators on chart at the bar close, and based on that, either give an alert, or draw coloured bars, it does not really matter what it does.

For example, we have two LWMAs on the chart with different period settings. As the bar closes, the indicator would compare their values, and if the shorter one is higher than the longer, it would draw a blue bar in a separate window. As simple as that.

I need it for my mql studies, I'm a bit overwhelmed with theory now and want to do something practical. Thanks in advance!

 

How to call Function when when the trade is execuating ?

Please help me

how I call a funcion when the trade is executing when opening new trade or closing a trade or creating a pending order, I I want to call function

 
prasantha60:
Please help me how I call a funcion when the trade is executing when opening new trade or closing a trade or creating a pending order, I I want to call function

What function do you want to call? Not really sure what you're question is.

 
Files:
 
Reason: