Hi,
Would really appreciate if anyone could help me to add alert to my indicator...
This the Part for "BUY" alert
And this the part for "SELL" alert
Thank you!
Would really appreciate if anyone could help me to add alert to my indicator...
Inserted Code
//---------------------------------------------------------------------------------------- input string __________1__________="xxxxxxxxxxxxxxxxxxxxx"; input string __________2__________="=ARROW CODE=";//ARROW DETAILS input string __________3__________="xxxxxxxxxxxxxxxxxxxxx"; input int ARROWUP =217;//ARROW CODE input int ARROWDN =218;//ARROW CODE input color ARROWUPc=clrWhite;//Arrow Up Color input color ARROWDNc=clrWhite;//Arrow Dn Color //---------------------------------------------------------------------------------------- //--- indicator buffers double ArrUpBuffer[]; double ArrDnBuffer[]; //--- //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping IndicatorBuffers(2); SetIndexBuffer(0,ArrUpBuffer);SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID,2,ARROWUPc);SetIndexArrow(0,ARROWUP); SetIndexBuffer(1,ArrDnBuffer);SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,2,ARROWDNc);SetIndexArrow(1,ARROWDN); return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { //--- int i,limit; limit=rates_total-prev_calculated; if(prev_calculated>0)limit=limit+2; for(i=limit-2;i>=0;i--) { if( iMA(_Symbol,_Period,5,0,MODE_LWMA,PRICE_LOW,i+1)<iBands(_Symbol,_Period,20,2.0,0,PRICE_CLOSE,MODE_LOWER,i+1) ) {ArrUpBuffer[i+1]=iBands(_Symbol,_Period,20,2.0,0,PRICE_CLOSE,MODE_LOWER,i+1)-35*pix_y();} if( iMA(_Symbol,_Period,5,0,MODE_LWMA,PRICE_HIGH,i+1)>iBands(_Symbol,_Period,20,2.0,0,PRICE_CLOSE,MODE_UPPER,i+1) ) {ArrDnBuffer[i+1]=iBands(_Symbol,_Period,20,2.0,0,PRICE_CLOSE,MODE_UPPER,i+1)+35*pix_y();} } //--------------- return(rates_total); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ double pix_y() { return((ChartGetDouble(0,CHART_PRICE_MAX,0)-ChartGetDouble(0,CHART_PRICE_MIN,0))/ChartGetInteger(0,CHART_HEIGHT_IN_PIXELS,0)); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+
This the Part for "BUY" alert
Inserted Code
if( iMA(_Symbol,_Period,5,0,MODE_LWMA,PRICE_LOW,i+1)<iBands(_Symbol,_Period,20,2.0,0,PRICE_CLOSE,MODE_LOWER,i+1) ) {ArrUpBuffer[i+1]=iBands(_Symbol,_Period,20,2.0,0,PRICE_CLOSE,MODE_LOWER,i+1)-35*pix_y();}
And this the part for "SELL" alert
Inserted Code
if( iMA(_Symbol,_Period,5,0,MODE_LWMA,PRICE_HIGH,i+1)>iBands(_Symbol,_Period,20,2.0,0,PRICE_CLOSE,MODE_UPPER,i+1) ) {ArrDnBuffer[i+1]=iBands(_Symbol,_Period,20,2.0,0,PRICE_CLOSE,MODE_UPPER,i+1)+35*pix_y();}
Thank you!