Forex Forum - EarnForex - View Single Post - Alert question
Thread: Alert question
View Single Post
  #5 (permalink)  
Old 9th April 2010, 07:48
Default Avatar
intraforex intraforex is offline
Junior Member
 
Join Date: Jan 2010
Location: italy
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Enivid View Post
Can you copy the exact code of that part of your indicator? Maybe there is some syntax typo that causes this error.
Yes.This is the code:
MQL5 Code:
#property copyright "Copyright © 2009"
#property link      ""
#property version   ""
#property description ""


#property indicator_chart_window
#property indicator_buffers 1
double CCIBUFFER[];

static bool TriggerOnlyThisBar;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
void OnInit()
{
 
//---- indicator buffers mapping  
   SetIndexBuffer(0, CCIBUFFER);
   
}
//+------------------------------------------------------------------+
//| Custom CCI Arrows                                                |
//+------------------------------------------------------------------+
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 handle;
handle = iCCI(NULL, PERIOD_M5, 14, PRICE_CLOSE);
int buffer_num=BarsCalculated(handle);
CopyBuffer(handle,0,0,buffer_num,CCIBUFFER);
ArraySetAsSeries(CCIBUFFER,true);  

   {
     
         if((CCIBUFFER[0] > 0)&&
            (CCIBUFFER[1] < 0)&&
            TriggerOnlyThisBar != Bars(Symbol(),PERIOD_M5))
    {
      Alert(Symbol()," SIGNAL DOWN ");
       TriggerOnlyThisBar = Bars(Symbol(),PERIOD_M5);
    }    
   }
   
         if ((CCIBUFFER[0] < 0)&&
             (CCIBUFFER[1] > 0)&&
             TriggerOnlyThisBar != Bars(Symbol(),PERIOD_M5))    
    {
      Alert(Symbol(),"SIGNAL UP ");
       TriggerOnlyThisBar = Bars(Symbol(),PERIOD_M5);
        }

   return(rates_total);
}

Last edited by intraforex; 9th April 2010 at 07:50.
Reply With Quote